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
Add CollectionInfo in all Collections that have total_entries #14366
Conversation
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test please?
The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest master or amend the last commit of the PR, and push it with --force-with-lease. |
@@ -1425,6 +1425,8 @@ components: | |||
type: array | |||
items: | |||
$ref: '#/components/schemas/ConnectionCollectionItem' | |||
total_entries: | |||
type: integer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this will work, we have a CollectionInfo component. I will suggest we use it and expand to other Collection components that do not have total_entries.
For the ConnectionCollection, I would suggest this:
ConnectionCollection:
type: object
description: Connections
allOf:
- type: object
properties:
connections:
type: array
items:
$ref: '#/components/schemas/ConnectionCollectionItem'
- $ref: '#/components/schemas/CollectionInfo'
This is because the CollectionInfo component explains what total_entries is and since this change will affect many components, it's better we use the CollectionInfo component.
You can expand this change to DAGRunCollection, PoolCollection, VariableCollection etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allOf
is always a headache in openapi 3.0, but surprisingly this one works
my guess is because CollectionInfo
is not nullable otherwise we are doomed 😂
i'll add the rest, thanks 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ephraimbuddy done 🚀
i updated all collections for all available API endpoints except ExtraLinkCollection
and TaskCollection
which don't have total_entries
forgive my ignorance on this... since i didn't change the underlying API models, i thought there was no way to really test it until we generate clients using the specs 🤔 airflow/tests/api_connexion/schemas/test_connection_schema.py Lines 120 to 141 in b995127
|
Right, yeah that should suffice |
i had to fix a few other 🐛 to make these endpoints work in my python sdk, for example, several missing |
Let's fix only the collection info for this PR, You can make another PR for another one. airflow/airflow/api_connexion/openapi/v1.yaml Lines 270 to 271 in 11d03d2
You have to remove CollectionInfo here since it's already part of the other component |
ha, i actually removed them long ago since they never worked with the openapi python generator |
You have to remove it. The total entries is now inside the ConnectionCollection component. Without removing it here, there tests will not pass |
happy to 😁 |
done 🚀 |
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
- type: object | ||
properties: | ||
connections: | ||
type: array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have linting errors in ConnectionCollection. Can you install pre-commit so you can find issues locally before committing. https://github.com/apache/airflow/blob/master/STATIC_CODE_CHECKS.rst#pre-commit-hooks.
This should work:
ConnectionCollection:
type: object
description: Collection of connections.
allOf:
- type: object
properties:
connections:
type: array
items:
$ref: '#/components/schemas/ConnectionCollectionItem'
- $ref: '#/components/schemas/CollectionInfo'
If you accept, I can push a fix for you but first try and see if you are able to resolve it. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done 🚀
sorry about that, planned to do it after the weekend 😁
The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest master or amend the last commit of the PR, and push it with --force-with-lease. |
Awesome work, congrats on your first merged pull request! |
Added a missing property in ConnectionCollection to avoid this error when using the generated Python client:
See here:
airflow/airflow/api_connexion/schemas/connection_schema.py
Line 53 in 3a046fa
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code change, 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 UPDATING.md.