Skip to content

Format validation of integer types #922

Answered by gregsdennis
lud asked this question in Q&A
Discussion options

You must be logged in to vote

We can have a schema of {"type": "integer", "format": "int64"}.

Yes. This is correct. I believe that's the intended purpose for that OAS format as well.

should the format fail if the data is not a string?

Should my validator fail if the input data is not an integer (say an array), or should it check that the format does not applies to arrays and ignore it?

Formats ignore (implicitly pass) instance types they don't check. So if you have int64 and don't get an integer, the validation is skipped.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lud
Comment options

Answer selected by lud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants