valid-header-example
Overview
This rule belongs to the openapi-v3-standards-linting
ruleset and states that:
The example value specified for the Header Object using either the example
property or examples
must be valid for the schema definition and encoding properties (if present) of that header.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Warning |
Message | Example does not conform to the header's schema or encoding definition. |
Code | OPENAPI3STANDARDS_L133 |
Type | Linting |
Rule System | Semantic |
Broad Category | Headers |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi standards semantic linting examples example value header schema type encoding style explode |
Suggested Fixes
- Ensure that header example value conforms to the header schema definition.
- Check that no required properties are missing in the sample value.
- Check that types of all properties match those specified in the schema definition.
- Header encoding properties include style and explode.
- If header level style or explode are specified, ensure that the example is valid with respect to them.
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.1.0.md#schema-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#schema-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md
- https://docs.apimatic.io/rulesets/overview/