schema-property-read-only-or-write-only-but-not-both
Overview
This rule belongs to the openapi-v3-standards-validation ruleset and states that:
A Schema Object property defined in an OpenAPI 3.0.x document under the properties property, cannot be marked as both read-only as well as write-only i.e. the property definition must not set both readOnly and writeOnly as true.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Error |
| Message | Property is marked as read-only as well as write-only. |
| Code | OPENAPI3STANDARDS_V336 |
| Type | Validation |
| Rule System | Semantic |
| Broad Category | Schemas |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | openapi3 openapi standards semantic validation read only write only property schema |
Suggested Fixes
- Either set value of property
readOnlyor that ofwriteOnlyas false. - Remove either the property
readOnlyorwriteOnlyfrom the Schema Object definition of the property.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-20
- 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#openapi-specification
- https://docs.apimatic.io/rulesets/overview/