Skip to main content
Version: Current (v7.0.0-beta.3)

Draft-04 boolean exclusiveMinimum and exclusiveMaximum misread beside an option's bounds

Detect​

  • Your schema, written for draft-04 or OpenAPI 3.0, uses exclusiveMinimum: true or exclusiveMaximum: true on a field with anyOf/oneOf options or on one of its options.
  • On the rendered page or in validation, a number field's bound is exclusive where you meant it inclusive.

Change​

An option now inherits its field's bounds and keeps the stricter of the two (see A non-object field's anyOf or oneOf option renders with its parent's keywords). The bounds are read as draft-06 and later define them, where exclusiveMinimum and exclusiveMaximum are numbers of their own. The draft-04 boolean form is not supported. Beside a numeric bound from the other schema it can make a bound exclusive that neither schema did: a field's maximum: 3 and an option's { maximum: 5, exclusiveMaximum: true } render as less than 3.

Use the numeric form:

-{ "maximum": 5, "exclusiveMaximum": true }
+{ "exclusiveMaximum": 5 }

Verify​

  • With a field's maximum: 3 and an option's exclusiveMaximum: 5, the field accepts 3.
  • No exclusiveMinimum or exclusiveMaximum in your schemas holds a boolean.

Also read: