valid-example-value-for-associated-schema
Overview
This rule belongs to the openapi-v3-standards-linting ruleset and states that:
The example value specified in the Example Object using the value property must be compatible with the associated type schema definition.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Warning |
| Message | The example value does not conform with the associated type schema definition. |
| Code | OPENAPI3STANDARDS_L120 |
| Type | Linting |
| Rule System | Semantic |
| Broad Category | Examples |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | openapi3 openapi standards semantic linting example value schema |
Suggested Fixes
- Ensure that the example value conforms to the schema type 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
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#example-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#example-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/