Skip to main content

schema-example-or-default-value-exists

Overview

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

Schema Object must specify a non-null, non-empty example value using the example property or a default value using the default property if applicable.

PropertyValue
EnabledYes
Maximum SeverityInformation
MessageSchema object example/default value is missing.
CodeOPENAPI3DOCSGEN_L753
TypeLinting
Rule SystemSemantic
Broad CategoryOpenAPI Schemas
Products ImpactedDeveloper Experience Portal
Tagsdocumentation generation documentation docs openapi3 openapi semantic linting apimatic default value value default example schema

Suggested Fixes

  • If the schema definition has a default value, it must be specified using the default value.
  • If the schema has no default value, ensure that the example property is present in the Schema Object.
  • Ensure that the schema example or default value is not empty or null.
  • The example or default value specified must be valid in accordance with the schema type definition.

For More Information