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

Generic JSON input #239

Open
Stranger6667 opened this issue Jun 29, 2021 · 0 comments
Open

Generic JSON input #239

Stranger6667 opened this issue Jun 29, 2021 · 0 comments

Comments

@Stranger6667
Copy link
Owner

At the moment, jsonschema supports only serde_json, which is convenient, but implies significant overhead in some cases. For example, in Python bindings, I got to convert Python structures to serde_json::Value first and this conversion takes up to 85% of the overall validation time. It will be much faster if those Python objects will be used directly without conversion.

It could be done with a generic Json trait that will implement some API on the input data (likely similar to serde_json). In this case, implementing Json on a newtype wrapper around PyAny will eliminate the need for conversion. Additionally, it will reduce the memory footprint as no copying will be needed.

For existing serde_json data it should be optimized away as the wrapper will just delegate the calls to serde_json::Value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant