Skip to content

allOf reference field is not displayed as required #1163

@tim-pankoke

Description

@tim-pankoke

Describe the bug

When using the allOf reference in swagger and defining the field as required the required flag is not displayed.

Expected behavior

I expect the required flag to be displayed if a field is defined as required (see Screenshot below).

Current behavior

The field is missing the required flag.

Possible solution

N/A

Steps to reproduce

Use the swagger.json file below and generate the open api documentation.

Screenshots

Image

Context

{
  "openapi": "3.0.0",
  "paths": {
    "/v1/entity/{id}": {
      "get": {
        "description": "Returns all available details for the requested entity.",
        "operationId": "EntityController_findOne_v1",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns the requested entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReadEntityDto"
                }
              }
            }
          }
        },
        "summary": "Read Entity",
        "tags": ["Entity"]
      }
    }
  },
  "info": {
    "title": "Test Service",
    "description": "This is a test.",
    "version": "1",
    "contact": {}
  },
  "tags": [
    {
      "name": "Entity",
      "description": "Endpoints to manage entities."
    }
  ],
  "components": {
    "schemas": {
      "EntityTypeDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Id of the entity type"
          },
          "displayName": {
            "type": "string",
            "description": "Name of the entity type"
          }
        },
        "required": ["id", "displayName"]
      },
      "ReadEntityDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Id of the entity"
          },
          "entityType": {
            "description": "Type of the entity",
            "allOf": [
              {
                "$ref": "#/components/schemas/EntityTypeDto"
              }
            ]
          }
        },
        "required": ["id", "entityType"]
      }
    }
  }
}

Your Environment

  • Version used: 4.4.0
  • Environment name and version (e.g. Chrome 59, node.js 5.4, python 3.7.3): Firefox 139.0.1
  • Operating System and version (desktop or mobile): both

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions