missingType
missingType
will check that all schemas and their properties have a type
field defined. This helps ensure that your OpenAPI specification is explicit about the data types expected for each schema and property.
The function intelligently skips schemas where type can be inferred or is not required:
- Schemas with
enum
orconst
values (type can be inferred) - Polymorphic schemas (
allOf
,oneOf
,anyOf
) - Schemas where structure implies type (has
properties
,items
,additionalProperties
, orpatternProperties
)
Example ruleset configuration
oas-missing-type:
description: "Schemas and properties must have a type defined"
type: "validation"
recommended: true
severity: "info"
given: "$"
then:
function: "missingType"
The function is used by the oas-missing-type Rule