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

protoc-gen-openapiv2: option to add swagger extensions to enums #4908

Closed
hown3d opened this issue Nov 5, 2024 · 5 comments
Closed

protoc-gen-openapiv2: option to add swagger extensions to enums #4908

hown3d opened this issue Nov 5, 2024 · 5 comments

Comments

@hown3d
Copy link
Contributor

hown3d commented Nov 5, 2024

🚀 Feature

It would be great if it was possible to add swagger extensions to proto enums.
We currently rely on extension pretty heavily and it's unfortunate that you can provide extensions to messages but not to enums.

@johanbrandhorst
Copy link
Collaborator

Hi, I'm confused what you're asking for here. What do you want an enum extension to do? The grpc-gateway implements the spec as provided by http.proto. I don't believe there is any enum functionality missing.

@hown3d hown3d changed the title protoc-gen-openapiv2: option to add extensions to enums protoc-gen-openapiv2: option to add swagger extensions to enums Nov 6, 2024
@hown3d
Copy link
Contributor Author

hown3d commented Nov 6, 2024

Im sorry, my initial issue title was sort of misleading.

I'd like to add swagger extensions to enums like it's already possible with protobuf messages using the Schema proto option.

@johanbrandhorst
Copy link
Collaborator

Do you have a specific use case? I think I understand a bit better but I still would like to get to the real requirement. Are you currently post-processing your openapi files?

@hown3d
Copy link
Contributor Author

hown3d commented Nov 7, 2024

We generate our SDK from the openapi files and use the swagger extensions to control visibility, type naming etc.

For example our enums in the openapi spec look like this:

v2ClusterStatusState:
  default: STATE_UNSPECIFIED
  enum:
    - STATE_UNSPECIFIED
    - STATE_HEALTHY
    - STATE_CREATING
    - STATE_DELETING
    - STATE_UNHEALTHY
    - STATE_RECONCILING
    - STATE_HIBERNATED
    - STATE_HIBERNATING
    - STATE_WAKINGUP
  title: ClusterStatusState holds information about the current state of the Cluster
  type: string
  x-stackit-sdk:
    schema-name: ClusterStatusState

The x-stackit-sdk field currently has to be patched after generating the spec with the plugin.

@johanbrandhorst
Copy link
Collaborator

Just realized this is a dupe of #2671. Thanks for reporting it.

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