Skip to content

Nested object properties use a boolean required instead of an array #2117

Closed
@jsw

Description

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Nested object properties are using required: true instead of an array. I am able to generate swagger that look like this:

      "OrganizationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "_count": {
            "type": "object",
            "properties": {
              "users": {
                "required": true,
                "type": "number"
              }
            }
          }
        },
        "required": [
          "id",
          "name",
          "_count"
        ]
      },

This is rejected by openapi-generate

-attribute components.schemas.OrganizationDto.required is not of type `array`

Minimum reproduction code

https://gist.github.com/jsw/2f0cd1e35bf3f09b22bd02d784165792

Steps to reproduce

No response

Expected behavior

required should be an array instead of a boolean

Package version

6.1.2

NestJS version

9.1.2

Node.js version

16.17.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions