Skip to content

Add description field to ConnectionResponse model (#52692) #52713

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

Conversation

nrnavaneet
Copy link
Contributor

This PR adds the missing description field to the ConnectionResponse model used in the execution API.

Changes Made:

  • Added description to the Pydantic ConnectionResponse model in execution_api/datamodels/connection.py.
  • Updated the route logic in execution_api/routes/connections.py to include the description in the API response.

Why:

This change ensures that the API response fully represents the Airflow Connection object, aligning with the UI and CLI experience. It resolves issue #52692.

Let me know if further changes or tests are needed!

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.

I'm not sure if the models should be perfectly shared between the execution api and the public api.

Maybe the execution api clients (workers etc.. do not need the description at all (yet))

@nrnavaneet
Copy link
Contributor Author

Thanks for the input! I added the description field for completeness and consistency across UI, CLI, and API. If the execution API clients don’t need it, I’m happy to restrict it to the public API or update it based on your guidance.
Should I move the field to only the public API model instead?

@@ -38,6 +38,7 @@ class ConnectionResponse(BaseModel):
port: int | None
password: str | None
extra: str | None
description: str | None = Field(default=None, description="Connection description")
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @nrnavaneet for your first PR! There is already a description field in line 34. If you want to include Field description, feel free, but since the field is str | None, it should also default to None automatically, so I don't think the default=None part is needed in this context.


What do you think?

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.

I read to fast and thought this was a change in the execution API only datamodels.

ConnectionResponse already has a description field. What are we trying to achieve?

@pierrejeambrun
Copy link
Member

pierrejeambrun commented Jul 4, 2025

I understand now. You're just modifying the wrong datamodel. What you are looking for is:
execution_api/datamodels/connection.py. Indeed there, the ConnectionResponse does not have description field.

I think the execution API has his whole set of Datamodels that are tailored specifically for the execution_api needs. I don't think there is a wish to have unified datamodels by adding extra field there that are not needed.

cc: @ashb

@ashb
Copy link
Member

ashb commented Jul 4, 2025

Yeah, I don't know if description ever showed up to authors in the DAG, so I'm not sure this is actually a required change?

cc @gopidesupavan

@gopidesupavan
Copy link
Member

Yeah, I don't know if description ever showed up to authors in the DAG, so I'm not sure this is actually a required change?

cc @gopidesupavan

Yeah it just to align description field with the actual connection model, thats fine if it is not required for the task-sdk return response we can ignore that. It just i observed when i was fixing the schema filed :)

@nrnavaneet
Copy link
Contributor Author

Thanks everyone for the clarification!

As pointed out, the description field already exists in the public API model, and the execution API datamodels are intentionally lean and tailored for their use case. Since the description field is not required for execution API clients and doesn’t serve a functional purpose there, I’ll go ahead and close this PR.

Really appreciate the review and discussion — this helped me understand the separation between the public and execution API models better!

@nrnavaneet nrnavaneet closed this Jul 5, 2025
@pierrejeambrun
Copy link
Member

Thanks @nrnavaneet for your effort and comprehension, feel free to tackle any other unassigned issues, there are plenty of them and your help is very welcome!

@nrnavaneet
Copy link
Contributor Author

Thank You @pierrejeambrun

@nrnavaneet nrnavaneet deleted the fix/add-description-connectionresponse branch July 9, 2025 12:58
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants