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

Required string parameters accept empty value #58

Open
fernando-casanova-pyyne opened this issue Jun 2, 2022 · 2 comments
Open

Required string parameters accept empty value #58

fernando-casanova-pyyne opened this issue Jun 2, 2022 · 2 comments

Comments

@fernando-casanova-pyyne
Copy link

My application requires some fields, and the properties are working. However it allows empty strings to pass and I don't seem to find any configuration for this on the project. Can this gem validate this?
{ "type": "object", "properties": { "destination_postal_code": { "type": "string" }, "destination_city": { "type": "string" }, "expected_ship_date": { "type": "string" }, "fulfillment_hours": { "type": "string" }, "notes": { "type": "string" } }, "required": ["destination_postal_code", "destination_city", "expected_ship_date", "fulfillment_hours"] }
I cannot accept destination_postal_code==""

@remi
Copy link
Member

remi commented Jun 3, 2022

Hi @fernando-casanova-pyyne,

This gem really only uses the json_schemer gem to validate data against a JSON schema.

This question is more related to schema validation, so I think you should poke them with your question 🙂

@staycreativedesign
Copy link

My application requires some fields, and the properties are working. However it allows empty strings to pass and I don't seem to find any configuration for this on the project. Can this gem validate this? { "type": "object", "properties": { "destination_postal_code": { "type": "string" }, "destination_city": { "type": "string" }, "expected_ship_date": { "type": "string" }, "fulfillment_hours": { "type": "string" }, "notes": { "type": "string" } }, "required": ["destination_postal_code", "destination_city", "expected_ship_date", "fulfillment_hours"] } I cannot accept destination_postal_code==""

You probably want

"destination_postal_code": { "type": ["string", "null"] }

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

No branches or pull requests

3 participants