-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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 ignore_trailing_commas option #4609
base: develop
Are you sure you want to change the base?
Add ignore_trailing_commas option #4609
Conversation
7c7adb3
to
ed1d330
Compare
31dcd16
to
e0dfccd
Compare
Maybe the documentation should somewhere also mention JWCC - it's good when things have a name. |
How do you think about combining the two options We can name the new combined option I think that any user who choose to allow comments will not mind allowing trailing commas, and it is hard to imagine a use case where one must be enabled and the other disabled. Regarding compatibility issues, this will not affect the serialization results, nor will it refuse to accept inputs accepted by previous versions. It will just accept some inputs that would not have been accepted before. This solution is also conducive to adding new features in the future. But for me this is not important, because I only support adding two features of JWCC. |
Can I declare that this library would never add extensions (such as allow |
Never say never... |
No, please leave it as is as it would change the behavior of existing code. Just like with the |
I combine the documentation about comments and trailing commas. Any more suggestions? |
No, please leave it as is. We may combine this in the future, but right now, I would like the URLs of the documentation to not change (https://www.w3.org/Provider/Style/URI). |
Could we just add a redirect rule to redirect_maps:
'api/basic_json/operator_gtgt.md': api/operator_gtgt.md
'api/basic_json/operator_ltlt.md': api/operator_ltlt.md
'api/basic_json/operator_literal_json.md': api/operator_literal_json.md
'api/basic_json/operator_literal_json_pointer.md': api/operator_literal_json_pointer.md
'api/json_pointer/operator_string.md': api/json_pointer/operator_string_t.md
'home/code_of_conduct.md': community/code_of_conduct.md
+ 'features/comments.md': features/comments_and_trailing_commas.md |
Yes, but please revert anyway. |
Added examples and modified the corresponding documents and unit tests. Signed-off-by: chirsz-ever <[email protected]>
9cc35a4
to
36c5061
Compare
This PR adds
ignore_trailing_commas
argument to thedetail::parser
constructor,basic_json::accept
,basic_json::parse
andbasic_json::sax_parse
.Why
In short: I totally agree with the JWCC extension.
After adding this, we can parse tsconfig.json, which allow trailing commas. (By the way, VSCode has a
allowTrailingCommas
option in its json schema configuration).More projects would be attracted to use this library, e.g. R2Northstar/NorthstarLauncher#715.
Related issues: #1429 #1787 #1734
Detail Changes
ignore_trailing_commas
argument to thedetail::parser
constructor,basic_json::accept
,basic_json::parse
andbasic_json::sax_parse
.,
to non-empty objects and arrays for testing.Pull request checklist
make amalgamate
.