-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
Getting UnboundLocalError #157
Comments
@jinsoo960 Arrays can be validated with minItems/maxItems while Strings can be validated with minLength/maxLength as per the JSON Schema specification. There is an implicit type check ( https://json-schema.org/draft/2020-12/json-schema-validation.html#name-minlength |
Both For instance, if the schema is:
Since both The code block generated would be roughly of the form:
Note that My proposed fix is to add a separate generator function This is consistent with the behaviour of the online JSON Schema validator Hyperjump. |
…th_items` similar to `create_variable_with_length` which defines a variable `{variable}_items` insteaf of `{variable}_len` and call this function from `generate_min_items/generate_max_items` in `draft04.py`. This resolves a variable name (`{variable}_len`) conflict when one of `minItems/maxItems` is defined along with one of `minLength/maxLength` since these validations are intended for different data types.
@horejsek - I have raised a PR for this. |
Hello,
I am getting a weird error when trying to run validate.
gives
It seems like something goes wrong when using
minItems
/maxItems
withminLength
/maxLength
?The text was updated successfully, but these errors were encountered: