Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Unexpected 'style' property when referencing an enum #2815

Open
michael-pxr opened this issue Sep 4, 2024 · 0 comments
Open

[BUG] Unexpected 'style' property when referencing an enum #2815

michael-pxr opened this issue Sep 4, 2024 · 0 comments
Assignees

Comments

@michael-pxr
Copy link
Contributor

Describe the bug

The enums function from @tsed/schema can be used to create a referenced enum. When using this function, the generated OpenAPI Specification (OAS) contains an unexpected property style: "deepObject".

To Reproduce

E.g.

// The enum
export enum Scope {
    admin = 'admin',
    public = 'public',
}
enums(Scope).label('Scope');
// Enum used as query parameter
@Controller('/example')
export class ExampleController {
    @Get()
    @Returns(200, Example)
    async list(
        @QueryParams('scope')
        @Enum(Scope)
        scope?: Scope,
    ): Promise<Example> {}
}

which gives

          {
            "in": "query",
            "name": "scope",
            "required": false,
            "style": "deepObject", // <--- unexpected
            "schema": {
              "$ref": "#/components/schemas/Scope"
            }
          },

Expected behavior

The generated OAS should not contain "style": "deepObject" for the enum query parameter.

Code snippets

No response

Repository URL example

No response

OS

macOS

Node version

v20.12.2

Library version

v7.81.0

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: To do
Development

No branches or pull requests

2 participants