Skip to main content

read-only-for-properties-schema-only

Overview

This rule belongs to the openapi-v3-standards-linting ruleset and states that:

A Schema Object in an OpenAPI 3.0.x document can be marked as read-only using the readOnly attribute only if it is defining a schema property i.e. readOnly is relevant only for Schema Object properties schema definitions.

PropertyValue
EnabledYes
Maximum SeverityWarning
MessageSchema is marked as read-only but is not a property schema definition.
CodeOPENAPI3STANDARDS_L153
TypeLinting
Rule SystemSemantic
Broad CategorySchemas
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 openapi standards semantic linting read only property schema

Suggested Fixes

  • You can mark a property as read-only but not a root-level schema nor one nested directly under parameters, request body, responses, etc.
  • Ensure that readOnly attribute is being used in the Schema Object that is defining a property from the properties object.

For More Information