rest-guide
rest-guide copied to clipboard
Leading zeros aren't allowed for numerical types
When deciding on the guidelines for the schema of identifiers, one of the arguments was that integer type leads to less errors when both representations with and without leading zeros are being used because they'd be ignored.
However, it seems now that the JSON RFC doesn't allow “any leading zeros for numerical values” and the Jackson library also throws an exception for values with leading zeros. We tested the behavior on a (too) permissive validator at the time.
For URL parameters, the OpenAPI specification is vague if the same constraint as JSON should be applied. The swagger-request-validator library does enforce it.
We should re-evaluate the reasons for the guideline.