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

AIP 84: Migrate GET one ASSET legacy API to fast API #43825

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

amoghrajesh
Copy link
Contributor

@amoghrajesh amoghrajesh commented Nov 8, 2024

NOTE TO REVIEWERS
Only last 2 commits are relevant

Depends on #43783
related: #42370

Migrating the connexion API for GET one ASSETS to fastAPI.

Testing performed:

Same setup as #43783

API responses:

Legacy:
image

FastAPI:
image

Swagger Spec:
image

image


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@boring-cyborg boring-cyborg bot added area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. labels Nov 8, 2024
Copy link
Contributor Author

@amoghrajesh amoghrajesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pierrejeambrun a note for you

Comment on lines +75 to +76
"/{uri:path}",
responses=create_openapi_http_exception_doc([401, 403, 404]),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we can pass uri in the path parameters and fastAPI encodes and decodes it, for fastAPI to be able to recognise the uri's properly, following starlette's path convertor here.

The {uri:path} portion specifies that the uri part of the path is a variable that can contain any sequence of characters, including slashes (/), making it a path parameter.

{uri:path}
uri is the name of the path parameter.
:path tells fastAPi that this parameter should capture everything in the path.

References:

  1. https://stackoverflow.com/questions/72801333/how-to-pass-url-as-a-path-parameter-to-a-fastapi-route
  2. https://www.starlette.io/routing/#path-parameters

@@ -0,0 +1,66 @@
# Licensed to the Apache Software Foundation (ASF) under one
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should now move to airflow/api_fastapi/core_api/datamodels/assets.py after we merged PR: #43823

Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few common comments from the previous PR that this work is based off.

Otherwise looks good, I'll do a final in depth review once the previous PR is merged.

@rawwar rawwar added the legacy api Whether legacy API changes should be allowed in PR label Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. legacy api Whether legacy API changes should be allowed in PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants