Improve handling of unspecified and unrecognized integer and number formats

Merged
#18 · Created  · Last updated

Merged pull request

Merged in kevinoid/swagger-request-validator/number-format-improvements (pull request #18)

09d0741·Author: ·Closed by: ·2017-01-02

Description

This PR makes the following changes to improve the format handling for integer and number types:

  • Allow format to be unspecified (null). This is explicitly allowed by the Swagger/OpenAPI spec both implicitly (by lack of Required annotation) and explicitly in describing the "optional modifier property format".

  • Make format comparisons case-sensitive. Although this is not explicit in the spec, this is how the reference implementation behaves and how this project currently handles string formats.

  • Allow unrecognized formats. This is explicitly allowed by the spec and matches the current behavior of string formats. It also adds tests to ensure that type validation (e.g. integers are still integer) is still performed for unrecognized formats.

I hope you find it useful,

Kevin

0 attachments

0 comments

Loading commits...