Open kevburnsjr opened 3 years ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
6dae91c
) 97.11% compared to head (80b9537
) 97.77%. Report is 2 commits behind head on master.:exclamation: Current head 80b9537 differs from pull request most recent head f240cbf. Consider uploading reports for the commit f240cbf to get more accurate results
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I, too, do not enjoy needing two calls for peace-of-mind that my JSON will not break once I start processing it. This would be super handy to have merged into the library, and the PR looks well-tested and benchmarked.
@valyala, is there some hesitation with this feature which has left it in limbo for so long? If not, I think a lot of people would appreciate being able to avoid separate invocations. 🙏
I've updated the symbol names. ValidateParser
is now ValidParser
for brevity.
I will maintain a fork with this PR merged until this PR is merged for anyone who wants to use it.
https://github.com/logbn/fastjson-valid
Presently, users that want to validate their json before parsing need to run
Validate
andParse
separately.This is inefficient because each json string must be scanned twice.
This PR introduces a
ValidParser
which validates as it parses.It is slightly less efficient than the normal parser, but much more efficient than running
Validate
andParse
separately.Adds 7 new symbols to the API:
See #58