We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In schema, I don't see a way to define allowed values per field. Here is an example with allowed_values attribute
allowed_values
{ "type": "object", "$schema": "http://json-schema.org/draft-04/schema#", "properties": { "city": { "type": "string", allowed_values: ["Paris", "London"] }, "country": { "type": "string" } }, "required": ["country"] }
It means it returns an error if I pass a different city.
Is there any workaround to do this?
The text was updated successfully, but these errors were encountered:
Hi @IlyaUmanets,
I’m not sure, are you asking if it’s possible to do that using a schema? Or you are reporting a bug with ActiveRecord::JSONValidator?
ActiveRecord::JSONValidator
Sorry, something went wrong.
@remi, No, I do not report a bug. It's more like a question or suggestion rather than a bug.
@IlyaUmanets You could do string validation using the pattern field: https://json-schema.org/draft/2020-12/json-schema-validation.html#name-pattern
pattern
No branches or pull requests
In schema, I don't see a way to define allowed values per field. Here is an example with
allowed_values
attributeIt means it returns an error if I pass a different city.
Is there any workaround to do this?
The text was updated successfully, but these errors were encountered: