openapi-schema-to-json-schema
openapi-schema-to-json-schema copied to clipboard
schema with format overwrites minimum and maximum values
If a valid format
is given, it overrides any given minimum
and maximum
values.
Consider:
TestObject:
type: object
properties:
overridingInt:
type: integer
format: int32
minimum: 0
maximum: 10
overridingFloat:
type: number
format: float
minimum: -5
maximum: 10
results in:
{
"type": "object",
"properties": {
"overridingInt": {
"type": "integer",
"format": "int32",
"minimum": -2147483648,
"maximum": 2147483647
},
"overridingFloat": {
"type": "number",
"format": "float",
"minimum": -3.402823669209385e+38,
"maximum": 3.402823669209385e+38
}
},
"$schema": "http://json-schema.org/draft-04/schema#"
}
Same here. This is particularly a problem because our OAS guidelines state that all numbers (and integers) must have a format.
Just a heads up that #35 is ready for merge as far as I'm concerned. This PR will solve the issue.
@Lakitna -- Based on the comment in #35, do you plan on sending this PR to the new repo? This is a small but insanely helpful feature you created!
Yeah, I will when I get home today.
This issue will now be closed with the PR in the new repo: https://github.com/openapi-contrib/openapi-schema-to-json-schema/pull/2
Merged in new repo, you can close this.