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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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
generatecommands with different arguments, including the--modularoption 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
basepath and anestedpath which is a sub-resource of thebasepath. I was expecting the methods associated with each to be generated into their own field in theApiclass 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.tsAnd here's the interesting part of the generated code:
Notice how both methods are a part of the
basefield.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