encoding-deep-object-style-only-for-object-type
Overview
This rule belongs to the openapi-v3-standards-validation ruleset and states that:
The deepObject style can only be used when the type of the property is set as object i.e. it cannot be used for primitive or array types.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Error |
| Message | Deep object style cannot be used with the current property type. |
| Code | OPENAPI3STANDARDS_V150 |
| Type | Validation |
| Rule System | Semantic |
| Broad Category | Encoding |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | openapi3 openapi standards semantic validation deep object style object serialization property encoding |
Suggested Fixes
- Ensure that the
typeof the property set in the property's schema definition is equal toobject. - If the property type is not expected to be an object, change the value of the style property to one that supports non-object types e.g. form, spaceDelimited, pipeDelimited.
- If the property type is not expected to be an object and you are unsure about which style to use, simply remove the
styleproperty definition.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#encoding-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#encoding-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#style-values
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameter-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-specification
- https://docs.apimatic.io/rulesets/overview/