-
Notifications
You must be signed in to change notification settings - Fork 512
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
TS type aliases are not supported #204
Comments
I also can't do simple things like:
and then use it as a path param (trying to have my controller be db-agnostic):
This gives the following error when running
|
Can reproduce. |
@erykwarren What would you expect the swagger definition to look like for your type |
I am getting the exact same thing as @JakeStoeffler, any plan on supporting custom types for defining path params? |
We just ran into the same issue, any updates on it? |
@simllll from what I can tell of reading the code, tsoa simply never supported type aliases. That being said, we’d certainly be open to a PR to support this. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days |
Accidentally closed it because I was scrolling on mobile. I’ve reopened it. |
@erykwarren @simllll @fbarbare @Esya @Superd22 @JakeStoeffler @ronjouch @james-ingold, @bgsandan, @WretchedDade, @AlexChambers, @HarryGogonis @adikaladik @AlexChambers -- We're super excited to share that we have a beta release of the type alias feature available and we'd love you to try it so we can consider releasing it to everyone. It's simple to do. All you have to do is install it with the tag. So like this:
or
Please let us know in this thread if you like it or if you find any bugs and we can cut the Thanks goes out to @WoH for his incredible work on this contribution. 🎉 🎈 🥇 |
Hi @dgreene1. Hope you're welcoming some feedback on this issue :) I've tried testing the V3 beta but I am still getting the same error as in the example given by Jake above (ie path param has custom type). Not sure if this issue attempted to solve exactly this use case or if it was specific to return types, or I'm being a noob and doing something completely wrong. export class IotService extends Controller { Cheers, |
Dan is currently busy so I hope it's ok if I respond on his behalf: export class IotService extends Controller {
@Get('iot/templates')
public async allTemplates(token: ApigeeToken, @Query() query: string): Promise<IotTemplate[]> {
// blah blah
}
} The issue occurs because tsoa has no way to know where your expected parameter |
Thanks for the quick response Wolfgang. I have controller like actions in my route and tried decorating my service which is completely wrong. I have now created new controllers which work as expected. |
Mostly correct. You're free to register middlewares before you register the routes created by tsoa. See #62 However, we are getting way off track here, so in case you want to discuss this further or have additional support requests, please open a new issue. |
Hi,
where
How can I solve this, ideally without duplicating definitions? |
Here is an example:
Running
tsoa routes
throws a TypeError:The text was updated successfully, but these errors were encountered: