at-least-one-item-in-schema-all-of-list
Overview
This rule belongs to the openapi-v3-standards-validation ruleset and states that:
The allOf property in a Schema Object is a logical operator that helps infer data validity based on results of its subschemas. Therefore, if declared, it must contain at least one subschema in its list i.e. the allOf array must not be empty.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Error |
| Message | Schema Object allOf list is empty. |
| Code | OPENAPI3STANDARDS_V343 |
| Type | Validation |
| Rule System | Semantic |
| Broad Category | Schemas |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | openapi3 openapi standards semantic validation all of json schema schema |
Suggested Fixes
- Ensure that the
allOflist contains at least one subschema. - If the
allOflist in the Schema Object is not expected to contain any subschemas, remove its declaration from the Schema Object.
For More Information
- https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-10.2.1.1
- 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#openapi-specification
- https://docs.apimatic.io/rulesets/overview/