schema-contains-exists-for-max-contains
Overview
This rule belongs to the openapi-v3-standards-linting
ruleset and states that:
The property maxContains
should only be used when the property contains
is also set in the same Schema Object. If contains
is not present, maxContains
has no effect.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Warning |
Message | Missing corresponding contains property in the Schema Object for maxContains . |
Code | OPENAPI3STANDARDS_L166 |
Type | Linting |
Rule System | Semantic |
Broad Category | Schemas |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi standards semantic linting max contains contains array schema |
Suggested Fixes
- Define the property
contains
in the Schema Object along withmaxContains
. - Remove the property
maxContains
from the Schema Object ifcontains
property is not expected to be set.
For More Information
- https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#section-6.4.4
- https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-10.3.1.3
- 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
- https://docs.apimatic.io/rulesets/overview/