Skip to main content

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.

PropertyValue
EnabledYes
Maximum SeverityError
MessageHeader Object has neither defined property schema nor content.
CodeOPENAPI3STANDARDS_V249
TypeValidation
Rule SystemSemantic
Broad CategoryHeaders
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 openapi standards semantic validation schema content type header

Suggested Fixes

  • Add missing schema or content property in the Header Object.
  • Make sure that whatever property you specify (schema or content) is a valid object and is not set to null.
  • The property schema is used more commonly while the property content is recommended for more complex scenarios involving media types.

For More Information