Skip to content
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

Add title property to GroupedOpenApi class for displaying a Human readable group name #1596

Closed
mzeijen opened this issue Apr 6, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@mzeijen
Copy link

mzeijen commented Apr 6, 2022

We are migrating from using the Swagger Maven plugin to SpringDoc. We had our custom grouping solution for being able to handle multiple API definitions. In our own custom Swagger UI setup, we show these different groups in a list. This is similar to how SpringDoc does this as well for its Swagger UI implementation.
However in our solution we allow the user to define the group identifier as well as a group display title. With SpringDoc we only have the group property in the GroupedOpenApi class, and we currently utilise it as both the identifier and the title, which is sub optimal as this then is both the identifier and the title. If a user would change it, because they want a nicer looking group name, they would inadvertently also change the identity of the group.

I propose we add a property (e.g. title, displayName or something similar) to the GroupedOpenApi that allows defining the human title of the group.

An alternative we considered is to extract the title from the OpenAPI Info object, and use it as the group title. However we believe they serve different purposes. For instance, the group title might need to be a shorter variant of the OpenAPI definition title, so that the list on the Swagger UI is easier to read, without compromising on the more extensive title of the definition itself.

If you agree with adding the property, I am willing to create a PR for it.

@bnasslahsen
Copy link
Collaborator

@mzeijen,

There are no plans to add this property.
If you feel it useful for the community, feel free to propose a PR and we can have a look at it.

@bnasslahsen bnasslahsen added the enhancement New feature or request label Apr 6, 2022
@mzeijen
Copy link
Author

mzeijen commented Apr 6, 2022

@bnasslahsen As indicated in my description, I was hoping to get some feedback first if you would even consider adding this as a feature. I will happily spend the time implementing it, but if I implement it and then you simply close the PR because you are not willing to add it, then that would be a waste of my time.

I don't need assurances that you will merge any PR related to this, I do would like to have an indication if you think this would be a sensible feature to add.

bnasslahsen added a commit that referenced this issue Apr 6, 2022
@bnasslahsen
Copy link
Collaborator

bnasslahsen commented Apr 6, 2022

@mzeijen,

I have added the enhancement you have requested, even there is not a lot of demand on it!
As mentioned earlier for your future requests, feel free to propose directly a PR.

You can use the latest snapshot to validate it.

@mzeijen
Copy link
Author

mzeijen commented Apr 7, 2022

@bnasslahsen Thank you very much. I tested it with my case and it works perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants