Skip to content

Generate correct "type" for Integer fields#118

Open
SteadBytes wants to merge 2 commits intofuhrysteve:masterfrom
SteadBytes:117-integer-type
Open

Generate correct "type" for Integer fields#118
SteadBytes wants to merge 2 commits intofuhrysteve:masterfrom
SteadBytes:117-integer-type

Conversation

@SteadBytes
Copy link

Closes #117

Using a type of number and a format of integer is not documented in the JSON schema specification as a correct way to represent integers. Instead, a type of integer should be used as this ensure that validators will correctly validate inputs as an integer and not accept
number values.

This is a breaking change as there is potential for previous successful validations to fail if users are validating number (e.g. floats) values against integer fields.

Using a "type" of "number" and a "format" of "integer" is not documented
in the JSON schema specification as a correct way to represent integers.
Instead, a "type" of "integer" should be used as this ensure that
validators will correctly validate inputs as an integer and not accept
"number" values.

https://json-schema.org/understanding-json-schema/reference/numeric.html?highlight=integer#integer

Signed-off-by: Ben Steadman <steadmanben1@gmail.com>
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling c7518dc on SteadBytes:117-integer-type into 81f08af on fuhrysteve:master.

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

Successfully merging this pull request may close these issues.

Incorrect integer type

3 participants