Last updated

no-required-schema-properties-undefined

Ensures there are no required schema properties that are undefined.

OASCompatibility
2.0
3.0
3.1
Root
Components
Schemas

API design principles

If a required schema property is declared but not defined, this rule informs you which of the required schema properties are missing.

Configuration

OptionTypeDescription
severitystringPossible values: off, warn, error. Default off (in recommended configuration).

An example configuration:

rules:
  no-required-schema-properties-undefined: error

Examples

Given this configuration:

rules:
  no-required-schema-properties-undefined: error

Example of incorrect schema properties:

schemas:
  Pet:
    type: object
    required:
      - id
      - name
    properties:
      id:
        type: integer
        format: int64

Expected error message when linting incorrect schema example:

Required property 'name' is undefined.

Example of correct schema properties:

schemas:
  Pet:
    type: object
    required:
      - id
      - name
    properties:
      id:
        type: integer
        format: int64
      name:
        type: string
        example: doggie

The rule is case-sensitive, which means a property name does not match the string Name in the required list:

schemas:
  Pet:
    type: object
    properties:
      name:
        type: string
    required:
      - Name

Resources