-
Notifications
You must be signed in to change notification settings - Fork 51
Add support for native JSON5 loading of schemas? #102
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
Comments
If you install Is this request different from the existing support? The word "native" can mean different things to different people. |
Sorry, maybe I haven't been clear enough. I'm asking for reading of JSON5 schema files, not running using JSON schemas against JSON5 instance files. For example: |
Ah, no, you were perfectly clear. I was just reading this wrong thinking "but we already have JSON5 support!" I'll need to think about this a little bit. The support for YAML schema definitions is already a potential sticking point for users (see #80 ).
So I need to consider whether or not this can be cleaned up and turned into something more like the instance loading (which is extensible to additional formats by design). |
The parser code is now better shared between instances and schemas, and JSON5 parsing of schemas is now supported. I've just released this as v0.17.0. Please let me know if you see any trouble with it! |
This would be really great because usually there are complex schemas that can only be documented inside multiline comments. There is a
$comment
keyword added in the draft 7 of JSON Schema but I find it useless for documentation, mainly because the lack of support for structured patterns like lists or code blocks.The unique problem that I see in a possible implementation is how to parse the
null
,NaN
andInfinity
keywords of JSON5, which are beyond JSON limitations. The safest would be, I think, to raise an error if found.Anyways, I'm not sure if this is beyond of the scope of this project.
Personal current workaround
I'm currently documenting schemas in files apart, but I'm planning to download the JSON5 files in a local folder caching and converting to JSON them, adding that folder to a .gitignore file.
The text was updated successfully, but these errors were encountered: