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

Support for const definitions #685

Closed
tshelburne opened this issue Jul 6, 2021 · 2 comments
Closed

Support for const definitions #685

tshelburne opened this issue Jul 6, 2021 · 2 comments
Labels
enhancement New feature or request planned Expected in an upcoming version PRs welcome PRs are welcome to solve this issue!

Comments

@tshelburne
Copy link
Contributor

Currently we have to use the following schema to define constants:

value:
  type: string
  enum: [some-constant]

Which results in:

type value = 'some-constant'

JSON schema supports defining with the const property, and it looks like OAI has adopted it as well? The definition would look like this:

value:
  type: string
  const: some-constant

And would result in the same Typescript as above.

@drwpow drwpow added enhancement New feature or request PRs welcome PRs are welcome to solve this issue! labels Sep 30, 2021
@sadfsdfdsa
Copy link
Contributor

sadfsdfdsa commented Dec 15, 2021

Working on it.

UPD: #831

@drwpow drwpow added the planned Expected in an upcoming version label Nov 4, 2022
@drwpow
Copy link
Contributor

drwpow commented Nov 4, 2022

This was added in v5 a while back, and support has improved for the upcoming v6 version.

@drwpow drwpow closed this as completed Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request planned Expected in an upcoming version PRs welcome PRs are welcome to solve this issue!
Projects
None yet
Development

No branches or pull requests

3 participants