Add "filter" by tag config

Created on 21 January 2022, almost 3 years ago
Updated 15 December 2023, 11 months ago

It would be useful to have filter by tag text filed in the top of endpoints rendered by Swagger UI.

I've tried add this to the swagger-config.jaml in the swagger-ui root directory but it does not work. On the contrary, the hardcoded into the current module config works.

Quite convenient when you have a ton of endpoints so you don't need to scroll up and down on the page. The only caveat filtering is case sensitive so you can use part of a tag name (shown in bold) string. See screenshot:

✨ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ͺπŸ‡ͺEstonia drugan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.3 & MariaDB 10.3.22
    last update 12 months ago
    1 pass
  • πŸ‡ΊπŸ‡ΈUnited States afinnarn

    @drugan I like the additional filter, but I also looked at https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configu... and added some more options in the patch I uploaded.

    What do you think about adding more defaults than filters? And also about adding a configuration form so we can modify config via CLI or UI?

  • πŸ‡ͺπŸ‡ͺEstonia drugan

    @afinnarn

    I've tested your patch and all additions work great. Especially collapsing tags and adding a fragment of the currently expanded operation to the URL.

    And yes, the configuration form would be useful. For example, there might be a case when you want to have a bird eye view on all the tags' operations expanded. If we go that way, obviously more defaults might be added so you can set up the UI exactly for your needs.

  • πŸ‡ΊπŸ‡ΈUnited States afinnarn

    I was trying to add a form just now, but thinking more about it, the "openapi" module should probably include a section in "OpenApiListController" to hold the configuration link to fit with the current UI pattern. I got stuck on what the proper path should be and how to handle config forms within that.

    For example, the path "/admin/config/services/openapi/swagger/my_json_api" shows the Swagger UI, but how would you add a setting form to that? "/admin/config/services/openapi/swagger/settings" isn't a good idea, and "/admin/config/services/openapi/settings/swagger" is also weird.

    So, I won't try to add the form right now until I look more at the main openapi module. Any thoughts are welcome, but that will be my approach to furthering this ticket.

Production build 0.71.5 2024