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

custom_objects_api should have a method list_custom_object_for_all_namespaces #268

Closed
davidxia opened this issue Sep 15, 2024 · 4 comments
Closed

Comments

@davidxia
Copy link
Contributor

What is the feature and why do you need it:

Similar to the core_v1_api like list_pod_for_all_namespaces, the custom_objects_api should have a method list_custom_object_for_all_namespaces.

Describe the solution you'd like to see:

list_custom_object_for_all_namespaces calls endpoint /apis/{group}/{version}/{plural} to get custom objects in all namespaces.

Although list_custom_object_for_all_namespaces and list_cluster_custom_object happens to talk to the same API endpoint, it may be better to have a list_custom_object_for_all_namespaces method for documentation purpose. kubernetes-client/java#941 (comment) is the right way to fix this issue. Since this issue affects multiple clients, would you mind filing an issue in https://github.com/kubernetes-client/gen about fixing the openapi spec?

— kubernetes-client/python#1377 (comment)

@davidxia
Copy link
Contributor Author

davidxia commented Sep 15, 2024

Seems like we need to add another "get" with {"operationId": ["listCustomObjectForAllNamespaces", ...} here?

"/apis/{group}/{version}/{plural}": {

But

OpenAPI defines a unique operation as a combination of a path and an HTTP method. This means that two GET or two POST methods for the same path are not allowed

— https://swagger.io/docs/specification/paths-and-operations/

How can we do it?

@brendandburns
Copy link
Contributor

We could consider using the hashtag approach as described here:

OAI/OpenAPI-Specification#182 (comment)

That may work. In general that discussion has numerous people trying to solve similar issues.

davidxia added a commit to davidxia/gen that referenced this issue Sep 16, 2024
for the API path `/apis/{group}/{version}/{plural}`.
We define a new key `/apis/{group}/{version}/{plural}#[U+200E]`
in `custom_objects_spec.json` to work around this limitation.

> OpenAPI defines a unique operation as a combination of a path and an HTTP
> method. This means that two GET or two POST methods for the same path are not
> allowed.

— https://swagger.io/docs/specification/paths-and-operations

We use the hair space empty character to visually hide this path param from the
Swagger UI.

closes kubernetes-client#268

Work around was taken from [here][1].

[1]: OAI/OpenAPI-Specification#182 (comment)
@davidxia
Copy link
Contributor Author

@brendandburns thanks! I made a PR #269

davidxia added a commit to davidxia/gen that referenced this issue Sep 16, 2024
for the API path `/apis/{group}/{version}/{plural}`.
We define a new key `/apis/{group}/{version}/{plural}#[U+200E]`
in `custom_objects_spec.json` to work around this limitation.

> OpenAPI defines a unique operation as a combination of a path and an HTTP
> method. This means that two GET or two POST methods for the same path are not
> allowed.

— https://swagger.io/docs/specification/paths-and-operations

We use the hair space empty character to visually hide this path param from the
Swagger UI.

may resolve kubernetes-client#268

Work around was taken from [here][1].

[1]: OAI/OpenAPI-Specification#182 (comment)
davidxia added a commit to davidxia/gen that referenced this issue Sep 16, 2024
for the API path `/apis/{group}/{version}/{plural}`.
We define a new key `/apis/{group}/{version}/{plural}#[U+200E]`
in `custom_objects_spec.json` to work around this limitation.

> OpenAPI defines a unique operation as a combination of a path and an HTTP
> method. This means that two GET or two POST methods for the same path are not
> allowed.

— https://swagger.io/docs/specification/paths-and-operations

We use the hair space empty character to visually hide this path param from the
Swagger UI.

addresses kubernetes-client#268

Work around was taken from [here][1].

[1]: OAI/OpenAPI-Specification#182 (comment)
k8s-ci-robot pushed a commit that referenced this issue Sep 18, 2024
for the API path `/apis/{group}/{version}/{plural}`.
We define a new key `/apis/{group}/{version}/{plural}#[U+200E]`
in `custom_objects_spec.json` to work around this limitation.

> OpenAPI defines a unique operation as a combination of a path and an HTTP
> method. This means that two GET or two POST methods for the same path are not
> allowed.

— https://swagger.io/docs/specification/paths-and-operations

We use the hair space empty character to visually hide this path param from the
Swagger UI.

addresses #268

Work around was taken from [here][1].

[1]: OAI/OpenAPI-Specification#182 (comment)
@brendandburns
Copy link
Contributor

Closed via #269

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants