TrustTheVote-Project / horatio-client

A client for an absentee ballot request form.
MIT License
2 stars 4 forks source link

Empty fields #16

Closed zakgreene closed 9 years ago

zakgreene commented 9 years ago

Ok, all of the JSON now validates, except I'm getting an error when I leave out the unit number.

Error in /delivery/unit:
String is too short (0 chars), minimum 1

Error in /assistant/unit:
String is too short (0 chars), minimum 1

In general, if a field is blank, should I also remove that key from the JSON object, or should I just leave the value blank?

waldoj commented 9 years ago

Yeah, that error is resulting because, in JSON, schema requirements are applied if a field exists. So the unit must be at least 1 character long if it exists. Fields that do not have a value should not be defined, which is to say that, yes, keys with blank values should be dropped.

zakgreene commented 9 years ago

Ok, keys with blank values are now dropped, and everything seems to be validating.