Swagger 2.0 Tags Being Ignored #1165
Unanswered
scottrobey
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there, I'm trying to generate Axios typescript code from a swagger 2.0 JSON file and it seems that "tags" in the JSON spec are being ignored. What's worse is that all methods are being put into the same TS field, that is the root-most path param for all of the endpoint URLs. Surely I must be doing something wrong, but I'm not sure what it is. I've tried running the
generate
commands with different arguments, including the--modular
option but still no luck.I've included a Swagger 2.0 JSON file and the generated code for the simplest example I could devise to demonstrate the issue.
In the Swagger JSON I have 2 paths, one
base
path and anested
path which is a sub-resource of thebase
path. I was expecting the methods associated with each to be generated into their own field in theApi
class because:Instead both get put into the same field, which means that on larger scale, real project, all methods for nested URLs end up in a single field which ends up being very difficult to manage.
Here's the JSON:
I ran the generate command using:
npx swagger-typescript-api generate --path ./swagger.json -o . -n api.ts
And here's the interesting part of the generated code:
Notice how both methods are a part of the
base
field.How can I get the generator to create 2 fields in this case, one for each tag or a separate field for the nested method. Something like:
Thanks, in advance, for any help provided.
Beta Was this translation helpful? Give feedback.
All reactions