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