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

Supprt for const keyword #252

Open
d-kimuson opened this issue Jan 7, 2024 · 0 comments
Open

Supprt for const keyword #252

d-kimuson opened this issue Jan 7, 2024 · 0 comments

Comments

@d-kimuson
Copy link

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

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

1 participant