YousefED / typescript-json-schema

Generate json-schema from your Typescript sources
BSD 3-Clause "New" or "Revised" License
3.17k stars 323 forks source link

Add optional flag to convert const to single value enums #570

Closed gassiss closed 1 year ago

gassiss commented 1 year ago

Hello! 👋

We rely on this library to generate JSON schemas to use with OpenAPI. Unfortunately, this PR introduced some breaking changes for us, as OpenAPI straight up doesn't allow constant values, and the workaround was to do exactly what the PR fixed.

Any chance we can get that behaviour back behind a feature flag? Seems like a pretty simple change, I have it working locally for our use case and would be happy to open a PR if that's OK.

Thanks for your work on this!

domoritz commented 1 year ago

Happy to accept a pull request. Maybe we can add a flag for openapi. If I recall correctly, there were some other requests that you can search for.

gassiss commented 1 year ago

nice! I'll open a PR for review soon. Thanks for the quick feedback!