valid-openapi-schema-type
Overview
This rule belongs to the openapi-v3-standards-validation
ruleset and states that:
The property type
in a Schema Object can have only of the following values: array
, object
, boolean
, integer
, number
, string
. Type null
can also be used but only for OpenAPI 3.1.x documents. Other types are not allowed.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | Schema type is invalid. |
Code | OPENAPI3STANDARDS_V325 |
Type | Validation |
Rule System | Semantic |
Broad Category | Schemas |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi standards semantic validation data type type schema primitive complex object array |
Suggested Fixes
- Type names are compared in a case-sensitive manner.
- Ensure that the schema type is not empty or null.
- Remove any trailing or leading whitespace or newline characters from the type value.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#data-types
- https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#section-6.1.1
- https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-4.2.1
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#data-types
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schema-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-specification
- https://docs.apimatic.io/rulesets/overview/