-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Schema with pattern re-compute regexp on each validate call #416
Comments
The ‘pattern’ keyword is not relevant here as the mentioned code is only for ‘format’, but indeed it verifies correctness of the input regex by trying to compile it. Not sure whether we can do anything about it besides adding some cache for inputs (but it is a a more broad issue for any validator) |
Is caching for input strings something that you were thinking about? |
I guess it could be nice to have a global cache for it - as format is universal and all ‘regex’ format validators could utilise it |
Hmm, really, if you don't specify "format", regexp caches fine. |
I don’t think there is something we can clarify from this library side as the JSON Schema spec describes this - these are two separate keywords that do not affect each others behaviour and target different things. ‘pattern’ keyword is about a pattern defined in the schema, ‘format: pattern’ is about a pattern in the input data |
Oh, really, I misunderstood the specification... |
No worries at all! On the contrary - I think it actually an interesting opportunity to explore caching possibilities for the “pattern” format |
Example schema:
https://github.com/Stranger6667/jsonschema-rs/blob/master/jsonschema/src/keywords/format.rs#L284-L294
The text was updated successfully, but these errors were encountered: