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

Validation Failed responses should be added into the swagger.json by default #1732

Closed
1 of 3 tasks
1muen opened this issue Dec 18, 2024 · 2 comments
Closed
1 of 3 tasks

Comments

@1muen
Copy link

1muen commented Dec 18, 2024

Sorting

  • I'm submitting a ...

    • bug report
    • feature request
    • support request
  • I confirm that I

    • [x ] used the search to make sure that a similar issue hasn't already been submit

Expected Behavior

As tsoa validates request payloads, it should insert an example "Validation Failed" response and type into the Open API Spec.

Current Behavior

I would need to add @response("422", "Validation error") at the Route level manually and Type it/give an Example for it.

Possible Solution

Tsoas default responses get added into the swagger.json

Steps to Reproduce

Context (Environment)

Version of the library: 6.6.0
Version of NodeJS: v20.9.0

  • Confirm you were using yarn not npm: [ ]

Detailed Description

Breaking change?

Copy link

Hello there 1muen 👋

Thank you for opening your very first issue in this project.

We will try to get back to you as soon as we can.👀

@WoH
Copy link
Collaborator

WoH commented Jan 7, 2025

You can use the decorator or validated returns via @Res(). The OpenAPI spec is not dynamic, i.e. we don't adapt it on the fly, we compile it ahead of time (to power runtime validation).

@WoH WoH closed this as not planned Won't fix, can't repro, duplicate, stale Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants