required-header-schema-or-content
Overview
This rule belongs to the openapi-v3-standards-validation
ruleset and states that:
The Header Object must define the type schema for the header using either the schema
or content
property. The former is used more commonly while the latter is recommended for more complex scenarios involving media types. However, at one time, only one of these properties must be present and not both.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | Header Object has neither defined property schema nor content . |
Code | OPENAPI3STANDARDS_V249 |
Type | Validation |
Rule System | Semantic |
Broad Category | Headers |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi standards semantic validation schema content type header |
Suggested Fixes
- Add missing
schema
orcontent
property in the Header Object. - Make sure that whatever property you specify (
schema
orcontent
) is a valid object and is not set to null. - The property
schema
is used more commonly while the propertycontent
is recommended for more complex scenarios involving media types.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#header-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#header-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-specification
- https://docs.apimatic.io/rulesets/overview/