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

Implement OpenAPI support for intEnum #1667

Closed
ericxinzhang opened this issue Mar 8, 2023 · 4 comments · Fixed by #1898
Closed

Implement OpenAPI support for intEnum #1667

ericxinzhang opened this issue Mar 8, 2023 · 4 comments · Fixed by #1898
Labels
feature-request A feature should be added or improved. OpenAPI

Comments

@ericxinzhang
Copy link

OpenAPI spec allows integer enums, e.g.

Sampling:
  type: integer
  enum: [1, 5, 10]

I created an intEnum type in my smithy model as following:

intEnum Sampling {
    ONE_PERCENT = 1
    FIVE_PERCENT = 5
    TEN_PERCENT = 10
}

I thought it would generate related enum in the OpenAPI spec but what I get is:

  "sampling": {
      "type": "number"
  }
@kubukoz
Copy link
Contributor

kubukoz commented Mar 9, 2023

Related: #1664

@kstich kstich added the feature-request A feature should be added or improved. label Mar 10, 2023
@kstich
Copy link
Contributor

kstich commented Mar 10, 2023

Thanks for opening this issue! We'd accept a change along these lines if you or your team is open to contributing it. As enum has been around for a while and is validated by several other consumers of OpenAPI, it should be gated behind a new feature flag in the OpenApiConfig with a corresponding update to the specification.

@ericxinzhang
Copy link
Author

Thanks for opening this issue! We'd accept a change along these lines if you or your team is open to contributing it. As enum has been around for a while and is validated by several other consumers of OpenAPI, it should be gated behind a new feature flag in the OpenApiConfig with a corresponding update to the specification.

Sorry @kstich I am not familiar with Smithy codebase, also it seems that you meant to put some links in your comments?
Anyway happy to contribute but I will need detailed instructions.

@srchase
Copy link
Contributor

srchase commented Jul 31, 2023

@ericxinzhang

Is this something you're interested in contributing still?

This is the OpenApiConfig class that @kstich mentioned. That class would need to be updated with a boolean feature flag that would allow intEnum support to be enabled as opt-in for now.

As part of that change, the docs would need to be updated. This guide covers OpenApiConfig: https://github.com/smithy-lang/smithy/blob/main/docs/source-2.0/guides/converting-to-openapi.rst#openapi-configuration-settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. OpenAPI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants