datahub-project / datahub

The Metadata Platform for your Data Stack
https://datahubproject.io
Apache License 2.0
9.76k stars 2.88k forks source link

Inconsistency with GraphQL createDomain mutation request #11135

Open aviv-julienjehannet opened 1 month ago

aviv-julienjehannet commented 1 month ago

Describe the bug We cannot change domain attributes thru the GraphQL API.

Steps to Reproduce the Issue

  1. Create a Domain: Use the createDomain mutation to create a domain with a specific ID, name, and description.
  2. Modify the Description: Attempt to re-run the createDomain mutation with the same ID but a modified description.

Expected Behavior As per the DataHub GraphQL documentation, the existing domain should be overwritten if a domain with the provided ID already exists.

Actual Behavior You receive a 404 error indicating that the domain already exists, which contradicts the expected behavior.

Screenshots image

Desktop (please complete the following information):

Additional context Given my DataHub version 0.13.3 and the issue described in GitHub Issue #10084 is still relevant, it appears that the problem persists even though the issue was closed.

chriscollins3456 commented 1 month ago

hey @aviv-julienjehannet! This is a great point, however this endpoint was only meant to actually create new domains, not upsert or update them. The id field here allows you to create a domain with a specific ID, so when you call createDomain with an ID that already exists, you'll get an error because the domain already exists. I see that the docs call this out but I believe those docs are outdated and need to be updated.

Right now your best bet for updating the description of an existing domain using graphql is to use the updateDescription endpoint passing in the domain urn as the resourceUrn.

Something we could do to support upserts like this would be to create a new upsertDomain endpoint which would be more classically named for the expected behavior.

Thank you for taking the time to put this issue together and call out the incorrect docs!