Skip to main content

schema-max-properties-cannot-be-less-than-min-properties

Overview

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

In OpenAPI specifications, if a minimum number of properties is defined for a schema, then a maximum number of properties should also be defined, and the maximum number of properties should be equal to or greater than the minimum number of properties.

PropertyValue
EnabledYes
Maximum SeverityWarning
MessageMaximum properties is less than the minimum properties.
CodeOPENAPI3APIMATIC_L683
TypeLinting
Rule SystemSemantic
Broad CategoryOpenAPI Schemas
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 openapi apimatic semantic linting minimum properties greater less maximum properties

Suggested Fixes

  • Check the OpenAPI specification to confirm if the minimum and maximum number of properties are defined for the schema.
  • If either the minimum or maximum number of properties is missing, add the missing property to the schema definition.
  • Make sure that the minimum and maximum number of properties are specified with appropriate data types (integer) and have non-negative values.
  • Ensure that the maximum number of properties is equal to or greater than the minimum number of properties.

For More Information