-
Notifications
You must be signed in to change notification settings - Fork 230
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
How to create an integer enum #1724
Comments
What is an int32 enum? OpenAPI doesn't have that concept I believe. Are you wanting to see a particular output in some other emitter? |
@bterlson sorry, it was integer. When generating the spec from the base asp.net sample todo app it generates this:
Looking into the spec (https://spec.openapis.org/oas/v3.0.3#schema-object) seems type and format are taken directly from JSONSchema. Looking into the code, seems member can either be a string or a number correct? typespec/packages/compiler/core/types.ts Line 286 in c2e1247
|
I think at the end it does not matter, I suppose, since there is a set of predefined values, it cannot be outside any of those values independently if are integer or number. |
JSON Schema doesn't define that format afaict, so I'm actually a little confused why we generate it in the first place. @mikekistler any thoughts? Is this something we should even be including in the output? |
The format is from here: https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#section-7.3 Use of format in OpenAPI2 predates any mention in Json Schema, though. |
It doesn't define the int32 format specifically though. While the spec allows for arbitrary values, it seems weird that we would include a format that most (all?) implementations wouldn't support. If the range of values is important, we could emit minimum and maximum which would be broadly supported... |
OpenAPI v2 does define the |
@markcowl correlate with bitfield support |
`Related to: #1237 |
The following enum:
Generates a
number
enum. Is there any decorator (or way) to force it to an int32 enum? I did try to find something in the documentation without luck.The text was updated successfully, but these errors were encountered: