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

Parse Enum values as literals #508

Closed
notaphplover opened this issue Feb 6, 2023 · 2 comments
Closed

Parse Enum values as literals #508

notaphplover opened this issue Feb 6, 2023 · 2 comments

Comments

@notaphplover
Copy link
Contributor

Description

Enum values should be parsed as literals as the spec states.

Expected behavior:

The following JSONSchema:

{
  "title": "Enum with JSON literal",
  "enum": [ { "type": "string" } ]
}

should be transpiled into the following typescript model:

export type EnumWithJSONLiteral = {type: "string"};

Current behavior:

The following JSONSchema:

{
  "title": "Enum with JSON literal",
  "enum": [ { "type": "string" } ]
}

is transpiled into the following typescript model:

export type EnumWithJSONLiteral = string;

Context

Consider the specs as references:

@notaphplover
Copy link
Contributor Author

@bcherny I just created #509 to fix this issue :)

@bcherny
Copy link
Owner

bcherny commented Feb 23, 2023

Published json-schema-to-typescript-12.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants