Skip to main content

at-least-one-property-in-schema-required-list

Overview

This rule belongs to the swagger-v2-standards-validation ruleset and states that:

If property required is specified in the Schema Object of a Swagger 2.0 document, it must be a list containing at least one schema property name that needs to be marked as mandatory.

PropertyValue
EnabledYes
Maximum SeverityError
MessageThe list of required properties defined in the Schema Object is empty.
CodeSWAGGER20STANDARDS_V311
TypeValidation
Rule SystemSemantic
Broad CategorySchemas
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsswagger2 swagger standards semantic validation required properties property name object json schema validation json schema

Suggested Fixes

  • If you do not intend to mark any property as required, remove the required property from the Schema Object as by default all properties are considered optional.
  • If you want to specify the required property, it must contain at least one entry.
  • The list of items in the required property need to be names of the properties defined inside the properties property of the Schema Object. The name of the property in the list must match exactly with the name of the schema property. Names are compared in a case-sensitive manner.

For More Information