You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From OpenAPI 3.1, the const keyword was added as a way to represent a single literal value. What was written with "enum": ["val"], "type": "string" can now be written with "const": "val", "type": "string".
The OpenAPI generation tool I use writes out single literal values as const (specifically ElysiaJS's swagger plugin) and openapi2aspida does not generate the proper type, so I created a feature request.
A feature request has been added to a similar tool, openapi-generator.
We can work around it by writing a single value to be passed to the enum as before, but there is no workaround if, like me, we have not written the specification manually and the code generation tool writes it out in this form. It may be possible to force substitution, but it is tough.
Additional context
The text was updated successfully, but these errors were encountered:
Description
From OpenAPI 3.1, the
const
keyword was added as a way to represent a single literal value. What was written with"enum": ["val"], "type": "string"
can now be written with"const": "val", "type": "string"
.ref: OAI/OpenAPI-Specification#1313 (comment)
The OpenAPI generation tool I use writes out single literal values as
const
(specifically ElysiaJS's swagger plugin) and openapi2aspida does not generate the proper type, so I created a feature request.A feature request has been added to a similar tool, openapi-generator.
ref: OpenAPITools/openapi-generator#10445
Describe the solution you'd like
Describe alternatives you've considered
We can work around it by writing a single value to be passed to the enum as before, but there is no workaround if, like me, we have not written the specification manually and the code generation tool writes it out in this form. It may be possible to force substitution, but it is tough.
Additional context
The text was updated successfully, but these errors were encountered: