datahub-project / datahub

The Metadata Platform for your Data Stack

Home Page:https://datahubproject.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

entity_types restrictions not working for structured properties

siladitya2 opened this issue · comments

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
  1. 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.