schema-exclusive-minimum-only-for-numbers
Overview
This rule belongs to the openapi-v3-standards-linting ruleset and states that:
The property exclusiveMinimum can only be used for Schema Objects when the type is either unspecified (implying any type), set as number or as integer. This property is not applicable for any other types.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Warning |
| Message | Property exclusiveMinimum is not applicable for the current Schema Object type. |
| Code | OPENAPI3STANDARDS_L182 |
| Type | Linting |
| Rule System | Semantic |
| Broad Category | Schemas |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | openapi3 openapi standards semantic linting exclusive minimum minimum number integer schema |
Suggested Fixes
- Ensure that the value of
typein the Schema Object is not set to a value other thannumberorinteger. - Type names are compared in a case-sensitive manner.
- If you use the
exclusiveMinimumkeyword, ensure that the data instance you intend to validate can be a number or integer. - If the type of the instance can vary i.e. it can be an number/integer or some other type, consider removing the
typekeyword to allow any types. If you use theoneOf/anyOfconstructs instead, consider moving theexclusiveMinimumto theoneOf/anyOfschema that has the type set asnumberorinteger.
For More Information
- https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#section-6.2
- https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#section-6.2.5
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md
- https://docs.apimatic.io/rulesets/overview/