datahub-project / datahub

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

entity_types restrictions not working for structured properties #10491

Open siladitya2 opened 4 months ago

siladitya2 commented 4 months ago

Describe the bug When we create a structure property with entity_types defined only dataset, we still can assign the structure property to other entity types(dataflow, datajob etc.) as well. Version: v0.13.1 To Reproduce Steps to reproduce the behavior:

  1. Create a structure property with below-mentioned definition through CLI or Open API.
    - id: my.test.SP01
    urn: urn:li:structuredProperty:my.test.SP01
    qualified_name: my.test.SP01
    display_name: SP01
    type: STRING
    cardinality: MULTIPLE
    entity_types:
    - dataset
  2. Try to assign the above created Structure property to a Dataflow Entity.

POST http://localhost:8080/openapi/v2/entity/dataset/urn:li:dataFlow:(airflow,test_instance1.demo-1%2F7,DEV)/structuredProperties Request Body:

{
  "properties": [
    {
      "propertyUrn": " urn: urn:li:structuredProperty:my.test.SP01",
      "values": [
        {"string": "bar"}
      ]
    }
  1. No error is thrown, and the structuredProperty is assigned to the Dataflow entity.

Expected behavior The structured property should not be assigned to the Dataflow entity. As the entity_types are defined as only allow datasets.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information): Datahub Version: v0.13.1

Additional context Add any other context about the problem here.

github-actions[bot] commented 3 months ago

This issue is stale because it has been open for 30 days with no activity. If you believe this is still an issue on the latest DataHub release please leave a comment with the version that you tested it with. If this is a question/discussion please head to https://slack.datahubproject.io. For feature requests please use https://feature-requests.datahubproject.io