Skip to main content

valid-parameter-example

Overview

This rule belongs to the openapi-v3-standards-linting ruleset and states that:

The example value specified for the Parameter Object using either the example property or examples must be valid for the schema definition and encoding properties (if present) of that parameter.

PropertyValue
EnabledYes
Maximum SeverityWarning
MessageExample does not conform to the parameter's schema or encoding definition.
CodeOPENAPI3STANDARDS_L065
TypeLinting
Rule SystemSemantic
Broad CategoryParameters
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 openapi standards semantic linting examples example value parameter schema type encoding style explode

Suggested Fixes

  • Ensure that parameter example value conforms to the parameter 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.
  • Parameter encoding properties include style, explode, allowEmptyValue and allowReserved.
  • If parameter level style, explode, allowEmptyValue, allowReserved are specified, ensure that the example is valid with respect to them.

For More Information