-
Notifications
You must be signed in to change notification settings - Fork 9k
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
Support Hierarchical Tags #5969
Comments
I'm willing and able to implement this, even if just for my own fork of SwaggerUI, so regardless of whether this feature gets official approval or not, I'd love for someone to give me a hint at where to start. |
This would be great! The doc would be much more organized for the front end folks of my project. |
Thanks for commenting! Good to know others find this desirable. To the devs: I repeat my offer to implement this and PR it if you'll give me a push to start me in the right direction ;). |
Yes, would be great to have such a feature! |
Yes, I am also looking for the same |
It'd be awesome to have such feature available - as of now, I need to create composed tags which causes lots of duplicates. |
I would also love this feature! |
I am also looking for the same thing. Happy to be told that header accept version can be documented in a different manner |
We need this feature too. Our API serves several products but also we have utility endpoints, global endpoints and product specific endpoints. It would be really helpful to be able to add sub headings and also even a description to each sub heading so you could explain the purpose of the grouping |
Yes it is a good feature |
Any movement on this feature? |
@kael-shipman you could probably just override the component https://github.com/swagger-api/swagger-ui/blob/master/src/core/components/operation-tag.jsx using the plugin api. https://swagger.io/docs/open-source-tools/swagger-ui/customization/plugin-api/ then implement recursive rendering of the operation-tag within the render function of the component. |
@mathis-m thanks for the specific tip and documentation! Very helpful. I'm a bit swamped at work right now, but I'll look into maybe building a plug-in for this when I get a chance. |
@kael-shipman for the plugin part I would use the wrapComponents plug point to conditional render either the hirachical operation tag component or the original component. |
Hi to everyone following this. Any thoughts on styling? This is what it looks like so far: I tried left-justifying, too, but that made the hierarchy significantly less useful. Open to suggestions. If anyone's a whiz with this kind of stuff (css, react, etc.), feel free to PR my PR over at kael-shipman/swagger-ui-plugins@hierarchical-tags |
Also, if anyone's really itchin' to get this going on their site, I just published the pre-release (v1.0.0-rc1) on github packages. You can get it by doing the following:
I believe that will work, but if it doesn't, I'd be happy to work through it with you. EDIT: If you don't already have github authentication set up for npm, you have to do that as well:
|
@kael-shipman let's make this a PR against swagger-ui. |
At least in the APIs I work with, this could still be very long. It'd be nice to have some kind of vertical gray line on the left to signify how deeply something is nested. |
Love it! That looks great! |
@tim-lai, @mathis-m and I are working on a PR to First, are you interested in this being part of Second, if it seems acceptable for |
In addition specification wise we are good to implement it.
|
I desperately need this functionality now. I'm a novice but willing to try it . Is it available as a plug-in I can just drop in. Corporate frowns on unofficial versions of major software but plug-ins are fair game! |
Hello @kael-shipman , i have a problem with your plugin and i would need your help to fix it: |
Are you still working on this? |
Looking for that too |
@chesiren sorry I missed this! I don't have time to mess with this right now, but I'm putting it on my to-do list and I'll see if I can get to it at some point. It's probably not a hugely difficult thing to fix. Will keep you posted. |
we need this. |
Yes we need this! |
We need this :D can I create a PR? |
please merge this, we need it |
This would be a great feature to have merged! |
From the description above:
|
An important question: Why the plugin could not be become in a npm package (uploaded to the npm repos)? Do not you think it could be easier to install it by a simple "npm install" command and not having the need to use a .npmrc file in any project? Thanks for advance. :) |
That's a good point, and actually it's a documentation problem. The package has been hosted on npm for a while now and I just forgot to update the docs. I've now updated the docs (see the same link above), so you should be good to go. |
Oh! Great thing! Another question: I know the plugin can be used on a client-side project, but, is it possible to use this plugin on any express project? Example to use:
Could it be possible with your plugin? if not, are you planning to develop the plugin, so that it can be used with express?. Thanks in advance. :) |
@char0n would there be a option to create like an third party plugins page within the swagger documentation? That would contribute to the overall position on market, cause it shows potential users or devs what can be done with the base product. I know that #5027 is there, but it is closed. Why not use the traffic that is there like on this PR, and take action, create a global entry point for swagger third party plugins. |
Love this idea ☝️ ☝️ |
For anyone coming to this issue looking for a solution, please see "Permanent Solution" section in the issue description at the top of this page. |
Package not found in NPM! |
Mm.... I just checked and here it is? |
Does it work on server side (nestjs) ?! |
@akhateeb22 not sure exactly what use-case you're referring to. You can install it just like any other npm package, but of course it's a front-end package, so the code needs to make it to your front-end somehow. NestJS is a back-end microservice framework, so not sure what you're going for here. |
I started looking for something to add a tree view and found it. It's just amazing work! |
@akhateeb22 I presume you mean, how to include it in the Swagger module for nestjs? I have managed to include it, though it is quite "hacky": // Include this in your bootstrap function in main.ts (or wherever you setup your nest app)
const swaggerConfig = new DocumentBuilder()
.setTitle('Hierarchical Tags')
.build();
const document = SwaggerModule.createDocument(app, swaggerConfig);
SwaggerModule.setup('api', app, document, {
swaggerOptions: {
plugins: [
(...args: any[]) => (window as any).HierarchicalTagsPlugin(...args),
// This is added by nestjs by default and would be overridden if not included
(...args: any[]) => (window as any).SwaggerUIBundle.plugins.DownloadUrl(...args),
],
hierarchicalTagSeparator: '/', // This must be a string, as RegExp will not survive being json encoded
},
customJs: ['https://unpkg.com/swagger-ui-plugin-hierarchical-tags'],
}); The The encapsulation of the plugins into functions is necessary, because this get's used client-side and functions are the only properties that are passed on as-is (see @nestjs/swagger/swagger-ui/helpers.ts). Also It's definitely not an ideal solution as it plays with the internal functioning of |
how did you get the |
@cse210001015 Yeah, that's the hacky bit. Unless
I haven't tried this with SSR, but I'm fairly sure it should still be executed client-side. |
Is your feature request related to a problem?
There is growing support in the OAS community for the idea of hierarchical tags (see OAI/OpenAPI-Specification#1367). The current consensus is that UIs like SwaggerUI can implement this with no change required in the OAS, and that this would be a much appreciated feature. I would like to implement it in SwaggerUI and would like help identifying the best way to do so.
Describe the solution you'd like
Tags such as
Petstore|Mammals|Dogs
should render asEDIT: Permanent Solution
I've implemented and published a plugin for this. Instructions for use are here. It works well as an ES module include in a webpack scenario OR as a global module via unpkg.
There is also a PR out for this (here), but it is long stale and I doubt that Swagger will ever take interest in it.(The PR has now been closed without merging.)The text was updated successfully, but these errors were encountered: