Repository navigation
[AIP-94] Add airflowctl providers get - #68854
Conversation
b363485 to
bb92d08
Compare
bb92d08 to
bd6c668
Compare
bd6c668 to
883bf75
Compare
pierrejeambrun
left a comment
There was a problem hiding this comment.
Thanks for the PR.
Can you provide more context as to why such an endpoint is needed atm? (And if returning everything is needed)
883bf75 to
73ec697
Compare
The core CLI command airflow providers get is already decorated with |
73ec697 to
9628516
Compare
4a8d140 to
d8c7254
Compare
d8c7254 to
647a42b
Compare
yuseok89
left a comment
There was a problem hiding this comment.
I noticed some provider metadata is missing from --full and left the details inline. The static checks also need to pass before merging.
airflowctl needs a stable server-side source for detailed installed-provider metadata without loading provider entry points on the client.
Provider metadata lives on the API server, and users need summary and full output compatible with the core CLI while the AIP-94 migration progresses.
The core command this replaces, airflow providers get, declares its
flag as ("-f", "--full") and is already marked
@deprecated_for_airflowctl("airflowctl providers get"). Users moving
across should not have to unlearn the short form.
The OpenAPI schema marks documentation_url as required on ProviderDetailsResponse, so the client model must not give it a default. With the default in place the datamodel codegen hook rewrites the file on every run, which fails the pre-push and CI checks.
Serializing the raw provider.yaml dict meant every key added to provider metadata in the future would be exposed through the public API by default, and the OpenAPI spec described provider_info as an untyped object. Modelling the response after provider_info.schema.json (the schema every provider is validated against at discovery time) turns serialization into an explicit allowlist and gives the generated UI and airflowctl clients real types. Also drops a no-op catch-reraise in the airflowctl providers operation, per review feedback on the PR.
The typed provider_info model drops every key it does not declare, so a provider whose metadata is made up mostly of the keys shared with the summary response came back nearly empty: `airflowctl providers get --full` returned less than the `airflow providers get --full` command it replaces.
8c9e9fb to
bccfae8
Compare
pierrejeambrun
left a comment
There was a problem hiding this comment.
Thanks for the updates! I compared airflowctl providers get --full against the deprecated airflow providers get --full for all 109 installed providers: 28 match exactly, the rest lose some connection-type and config metadata (details inline).
The provider detail response reused the kebab-case key names from provider.yaml, which would have made these the only non-snake_case fields in the public API and unusable as attributes in the generated clients. Reading the kebab-case keys is a parsing concern, so it moves to validation_alias and leaves serialization on the field names. Comparing the response against the deprecated `airflow providers get --full` also showed metadata silently dropped because the models did not declare it: ui-field-behaviour, conn-fields and external-services on connection types, and is_template and see_also on config options.
…iders-get # Conflicts: # airflow-core/src/airflow/ui/openapi-gen/requests/services.gen.ts
pierrejeambrun
left a comment
There was a problem hiding this comment.
LGTM, only needs a rebase before we can merge.
Keys ``ProviderInfoResponse`` does not declare are dropped from the response
without raising, so a key added to ``provider_info.schema.json`` would go
missing from ``GET /providers/{package_name}`` with nothing to signal it. This
PR lost ``ui-field-behaviour``, ``conn-fields``, ``external-services``,
``is_template`` and ``see_also`` that way until review spotted them by hand.
Why
Part of AIP-94. The public REST API only exposed a provider list endpoint, so there was no way for
airflowctl(or any API client) to look up a single installed provider by package name, and no way to see the full provider metadata (provider_infofromprovider.yaml) — the list endpoint returns only the name, version, description, and documentation URL.What
Public API (
airflow-core)GET /api/v2/providers/{provider_name}returning a newProviderDetailsResponse— the summary fields plus the fullprovider_infomapping — with404for unknown providers and the samePROVIDERSaccess-view guard as the list endpoint.map_provider_detailsinapi_fastapi/core_api/services/public/providers.py; regenerate the OpenAPI spec, UIopenapi-genclient, and the API permissions reference doc.TestGetProvidercovering 200/404/401/403 intest_providers.py.CLI (
airflow-ctl)airflowctl providers get <provider_name>(newprovider_command.py), printing a summary by default and the complete provider metadata with--full.ProvidersOperations.getinapi/operations.pyand the regeneratedProviderDetailsResponsedatamodel.merge_commands(ctl/cli_config.py): custom subcommands now replace auto-generated subcommands with the same name instead of being appended alongside them. This is needed because the OpenAPI-generated CLI already derives aproviders getfrom the new endpoint; without deduplication the group would contain twogetsubcommands. Previously duplicate names were a latent bug — nothing relied on the old append behavior.Was generative AI tooling used to co-author this PR?