JSON Schema validation in streaming mode without building full in-memory object
Hello,
First, thank you for the outstanding work on jsoncons. It's a very impressive and flexible library.
I’ve been looking into the JSON Schema validation features, and I’ve consulted the examples and documentation. However, I haven’t been able to find a clear example that shows whether it’s possible to validate a JSON document against a schema in a fully streaming way without building a full in-memory DOM I may have overlooked something, of course, but I’d really appreciate your clarification:
Does jsoncons support schema validation in true streaming mode, suitable for very large documents with low memory usage?
Many thanks in advance, and again, great work on the library.
Best regards,
It's not. The closest you'd be able to get to that would be to use the cursor api, reading nested objects or arrays into a basic_json, see this example, and applying sub-schemas to those.
I think it would be quite difficult to write a fully conforming, streaming JSONSchema validator, JSONSchema is complicated to implement, but I haven't really thought about it very much.
May I add the link to the jsonbuddy library, which includes a streaming validator (but running on Windows only) here. But I have to admit the streaming functionality is not free of charge. And yes, it is quite complicated to be implemented.
JSONBuddy's dll, jsonvalidator.dll, isn't open source. JSONBuddy is listed on JSON Schema Tools as an editor, and we don't have any bowtie tests. The most we have about compliance is the statement "Full support for Draft 4, 6, 7, 2019-09 and 2020-12 of JSON Schema" on their site, but I don't see any test results against the JSON Schema Test Suite. To me it's a black box, and it's hard to learn from it.