redoc icon indicating copy to clipboard operation
redoc copied to clipboard

Required properties in 3.1.0 spec not working when used as sibling

Open josefguenther opened this issue 10 months ago • 0 comments

Describe the bug When referencing another object without nesting in allOf (3.0 spec), Open API 3.1 spec allows us to declare required properties as sibling alongside $ref like this:

components:
  schemas:
    CreateAlbum:
      required: [ Description ]
      $ref: "#/components/schemas/Album"
    Album:
      type: object
      properties:
        Id:
          type: string
          readOnly: true
        Description:
          type: string

Expected behavior In route request body, using CreateAlbum should show Description as being required. However, it only works when $ref is nested in allOf, like this:

    CreateAlbum:
      required: [ Description ]
      allOf: 
        - $ref: "#/components/schemas/Album"

josefguenther avatar Apr 24 '24 19:04 josefguenther