-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fixes #1004: Support Swagger tags #1211
Conversation
if (!tags || tags.length == 0) tags = ['']; | ||
tags.forEach((tag, index) => { | ||
let id = | ||
endpointSchema.operationId + (index > 0 ? index : '') || `__REQUEST_${requestCount++}__`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a suffix with index as if the request has multiple tags, each request needs a unique id and thus append index to make it unique
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, that sounds like a good solution 👍
bb080c0
to
22360fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks awesome! This has been requested for a long time so thank you for taking care of it 🎆
if (!tags || tags.length == 0) tags = ['']; | ||
tags.forEach((tag, index) => { | ||
let id = | ||
endpointSchema.operationId + (index > 0 ? index : '') || `__REQUEST_${requestCount++}__`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, that sounds like a good solution 👍
What happened to this pr? seems to have never made it in? |
Hi @mawiseman 👋 I've imported https://petstore.swagger.io/v2/swagger.json and correctly puts the requests in different folders (each folder represents the tag on the request) so it looks like it has been merged. Do you have a URL / file where it doesn't work? That could help us figure out what's wrong 👍 These are my Insomnia details if it helps as well 😃
|
Thanks for looking into this @thewheat I have attached a cut down version of the swagger file I am trying to import. It was generated using the Swashbuckle library for dotnet core: https://github.com/domaindrivendev/Swashbuckle.AspNetCore You can see it is valid when pasting it into the online editor: https://editor.swagger.io/ Insomnia Import & Swagger View Here are my Insomnia details
|
Ah @mawiseman I see that your file says it is an Swagger definition in the Petstore example Did a test and if you add tags in the root definition it does correctly create the folders Digging further, from #2408 it looks like the beahviour of needing to add it to global scope is expected. Not ideal but if anything, I think that issue would be best for any further discussion 👍 |
Thanks @thewheat! |
Closes #1004
Update an existing pet
has tags ofpet
andstore
andAdd a new pet to the store
has no tags