-
Notifications
You must be signed in to change notification settings - Fork 15
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
API improvements #115
API improvements #115
Conversation
@itamarst FYSA, this PR introduces some API improvements per #105 so you can now do something like let cddl_schema = CDDL::from_slice(
r#"
foo = {
bar: tstr
}
"#.as_bytes(),
)
.unwrap();
let documents = [r#"{ "bar": "foo" }"#, r#"{ "bar": "foo2" }"#];
documents
.iter()
.all(|doc| cddl_schema.validate(doc.as_bytes(), None).is_ok()); Let me know what you think |
I can probably create a branch off of your branch, will try that. |
That is, create a branch of |
I tested |
(The lifetime requirements is still making interop with PyO3 hard, though, since it's explicitly not supported: PyO3/pyo3#502. So #104 is still blocker on keeping pre-parsed |
For reference, here's the branch using this branch: https://gitlab.com/tahoe-lafs/pycddl/-/blob/12-persistent-schema-instead-of-parsing-schema-on-each-validation/src/lib.rs |
Thanks for testing! Yea, I'll be working through #104 once I get this PR finished up. |
12601f0
to
b800209
Compare
Addresses #105 and #114