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

Add x-enumNames support #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RicoSuter
Copy link
Owner

@RicoSuter RicoSuter commented Oct 18, 2018

First: Thanks for this awesome project, works like a charm...

Reasons for making this change

Add support for the x-enumNames property which has the same semantics as enumNames but uses the x- prefix to declare it as a custom/extension property. I'm maintaining the NJsonSchema C# library which generates these properties from .NET enums. See https://github.com/RSuter/NJsonSchema/wiki/Enums

I think it makes sense to support this scenario because this prefix is required/defined in the JSON Schema spec. It seems that the proposal for the property enumNames has been rejected in favor of const (see below).

Alternatives

There are also const enums: json-schema-org/json-schema-spec#67 (comment)

Spec for const: json-schema-org/json-schema-spec#58

Checklist

  • I'm adding or updating code
    • I've added and/or updated tests
    • I've updated docs if needed
    • I've run npm run cs-format on my branch to conform my code to prettier coding style

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

Successfully merging this pull request may close these issues.

1 participant