-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Support for Constant Value in API #1620
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
Comments
Can you not do this with an MySchema:
type: object
properties:
MyProperty:
type: string
enum:
- constantValue |
Possibly related: #1313 |
Yes thats how it needs to be done now, but it's a bit verbose and it doesn't look nice in your documentation (generated web pages), where it will show as an expandable list of one item VS just the string value. |
LucasRoesler
added a commit
to contiamo/go-base
that referenced
this issue
Jul 20, 2020
**What** - Generate a Go `const` if the enum values has exactly one element - See OAI/OpenAPI-Specification#1313 and OAI/OpenAPI-Specification#1620 as examples where the openapi team blessed the "singleton enum" example Signed-off-by: Lucas Roesler <[email protected]>
rdner
pushed a commit
to contiamo/go-base
that referenced
this issue
Jul 20, 2020
**What** - Generate a Go `const` if the enum values has exactly one element - See OAI/OpenAPI-Specification#1313 and OAI/OpenAPI-Specification#1620 as examples where the openapi team blessed the "singleton enum" example Signed-off-by: Lucas Roesler <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since OpenAPI can be used to generate client code, it is good to support some constant value in the API itself.
Use case: When you add type info to a class as a properties, we need that property for deserialization and the value of this property will never change.
The text was updated successfully, but these errors were encountered: