Skip to content

Using "hideDefinitions" leads to Structural error in final spec #247

@luca-leanix

Description

@luca-leanix

Hi all,
we need to make use of the "hideDefintions" flag in order to get nested types being output correctly in our final spec file. The functionality itself works, however the "hideDefintions" flag appears in the final spec causing the issue to pop up when visualizing the swagger file (or when using cli-generators). Expectation would be that the flag does not appear in the final json file.

extendApi(
  z.object({
    hello: z.string(),
    world: z.union(z.array(CustomTypeA), z.array(CustomTypeB)),
  }),
  {
    hideDefinitions: ['world'],
    properties: {
      world: {
        anyOf: [
          {
            type: 'array',
            items: {
              $ref: '#/components/schemas/CustomTypeA'
            }
          },
          {
            type: 'array',
            items: {
              $ref: '#/components/schemas/CustomTypeB'
            }
          }
        ]
      }
    }
  }
);

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions