-
Notifications
You must be signed in to change notification settings - Fork 371
[Node.js Server] Tags and x-swagger-router-controller #325
Comments
Sorry, maybe better placed here : swagger-node ? |
Swagger is agnostic but There is support to do routing using the What's interesting is that Swagger actually requires unique All of this being said, I've actually already proposed that we remove I'm closing this because at best it is a duplicate of #221. |
Sorry but I can't figure how to manage a many tagged operation without x-swagger-router-controller extension, even with an operationId setted. As long as there is a generated function foreach generated controler foreach tag there is a need to set the route ... or I definitely miss something ! PS: My "not so nice" comment was not aggressive, it was just a point of view enforced by the so new "Open Api" generic position ;-) |
I didn't see it that way, I'm just saying that using vendor extensions for something like this is pretty much what they were created for. As for your issue, if you're running into issues with routing not working, you can run it via How swagger-router works, and is intended to be used, is documented here: https://github.com/apigee-127/swagger-tools/blob/master/docs/Middleware.md#how-to-use The idea is that you can either use |
Yes, I see, thx. |
I do think that tag-based routing could be a real thing but since they are not one-to-one, you'd still have collisions which would require something like |
Tags play role in that node generator generates a controller for each one ... and so multiply function named by operationId. That's why the idea behind the implicit rule "take only the first tag as the controller name" avoids to much "noisy code" (it's not an agressive expression at all ;-) |
Ah, I didn't know that swagger-codegen associated tags with controllers. swagger-codegen and swagger-tools are not directly related and it was up to the swagger-codegen author to do this. In swagger-node or swagger-tools, tags play no special role. I realize you're saying the the code generated as an association between controllers and tags but swagger-node, which uses swagger-tools for its middleware, is not the one creating the association and it does not honor/use the association as well because swagger-tools does not treat tags specially. I hope this is clear but at least now I know where this came from. |
Yes, firstly I should double check the main project involved by the topic ! |
Glad to help. Sometimes it's hard to see what project is doing what since a number of them play together. Let me know if I can help further. |
Yes, Swagger ecosystem is very rich ! and very powerful ! |
Hi, let start with following swagger.yaml fragment :
I undestood that x-swagger-router-controller extension and operationId are mandatory for node controller routing.
IMHO specific extension todo that is not so nice in an agnostic specification ...
The other thing is that there is a getStatus function in each controller for each tag.
So, in the example, getStatus() will exist in Commons & Admin generated controllers
Am I wrong ?
... if not, I'm wondering if the following default rule could be adopted (my 2 cents !):
maybe a naïve proposal ...
The text was updated successfully, but these errors were encountered: