Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with the DataPlatformInstance v3/entity/dataplatforminstance API methods #11317

Open
usmanovbf opened this issue Sep 6, 2024 · 1 comment
Assignees
Labels
bug Bug report platform PR-s that make changes to core parts of the platform

Comments

@usmanovbf
Copy link

Describe the bug
There are several issues with the DataPlatformInstance API provided by DataHub:

  1. HEAD Request Issue: The HEAD /v3/entity/dataplatforminstance/{urn} API returns a 404 Not Found response when checking the existence of a DataPlatformInstance that does exist.
  2. GET Request Generates Incorrect Data: The GET /v3/entity/dataplatforminstance/{urn} API generates fabricated data when a non-existent urn is specified, instead of returning an error.
  3. Empty Response for Scroll/List API: The GET /v3/entity/dataplatforminstance API with scroll or list parameters returns an empty response, despite having existing platform instances in the system.

To Reproduce
Steps to reproduce the behavior:

  1. HEAD Request Issue:

    • Make a HEAD request to https://datahub.example.io/openapi/v3/entity/dataplatforminstance/{urn} with a valid urn such as urn:li:dataPlatformInstance:(urn:li:dataPlatform:mysql,some-existing-platform-instance).
    • Example code:
    import requests
    
    DATAHUB_API_KEY = '<YOUR_API_KEY>'
    headers = {'Authorization': f'Bearer {DATAHUB_API_KEY}', 'Content-Type': 'application/json'}
    host = "https://datahub.example.io"
    
    urn = 'urn:li:dataPlatformInstance:(urn:li:dataPlatform:mysql,some-existing-platform-instance)'
    method = '/openapi/v3/entity/dataplatforminstance/{urn}'.format(urn=urn)
    
    r = requests.head(
        url=f"{host}{method}",
        headers=headers,
    )
    
    print(r.status_code)  # Outputs: 404
    • Error: 404 Not Found is returned, but the instance does exist.
  2. GET Request Generates Incorrect Data:

    • Make a GET request to the same endpoint but use a slightly altered urn that does not exist, such as urn:li:dataPlatformInstance:(urn:li:dataPlatform:mysql,example_instance_wrong).
    • Error: The response mimics a valid structure even though the data does not exist.

    Example incorrect response:

    {"urn":"urn:li:dataPlatformInstance:(urn:li:dataPlatform:mysql,example_instance_wrong)","aspects":{"dataPlatformInstanceKey":{"value":{"instance":"example_instance_wrong","platform":"urn:li:dataPlatform:mysql"}}}}
  3. Empty Response for Scroll/List API:

    • Make a GET request to https://datahub.example.io/openapi/v3/entity/dataplatforminstance with scroll or list parameters.
    • Error: The response is empty even though there are existing platform instances.

Expected behavior

  • For HEAD requests, the API should return 200 OK for existing instances and 404 Not Found only for non-existent ones.
  • For GET requests, the API should indicate an error when a non-existent urn is specified, rather than generating fabricated data.
  • For Scroll/List requests, the API should return a list of existing platform instances.

Screenshots
N/A (No UI involved, API behavior only)

Desktop (please complete the following information):

  • OS: N/A
  • Browser: N/A
  • Version: N/A

Additional context

  • DataHub version: v0.13.3
  • The API responses described above do not match expected behavior and could potentially mislead users.

Could you please investigate these issues or provide guidance on resolving them? Any help would be greatly appreciated.

@usmanovbf usmanovbf added the bug Bug report label Sep 6, 2024
@usmanovbf
Copy link
Author

@shirshanka shirshanka added the platform PR-s that make changes to core parts of the platform label Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report platform PR-s that make changes to core parts of the platform
Projects
None yet
Development

No branches or pull requests

3 participants