Skip to main content

valid-media-type-example

Overview

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

The example value provided for a Media Type Object using either the example property or examples must be in a correct format with respect to the media type and valid for the specified schema definition (if present).

PropertyValue
EnabledYes
Maximum SeverityWarning
MessageExample does not conform to the specified media type format or its schema definition.
CodeOPENAPI3STANDARDS_L080
TypeLinting
Rule SystemSemantic
Broad CategoryMedia Types
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 openapi standards semantic linting examples example value media type schema

Suggested Fixes

  • Ensure that the example value format matches the expected format based on the current media type.
  • Ensure that media type example value conforms to the media type's 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.

For More Information