swagger-api/swagger-ui

Add displayName to urls and use that in drop-down list

Open

#4.314 aberto em 12 de mar. de 2018

Ver no GitHub
 (8 comments) (0 reactions) (0 assignees)JavaScript (8.801 forks)batch import
Hacktoberfestcat: user experiencetype: enhancement

Métricas do repositório

Stars
 (25.447 stars)
Métricas de merge de PR
 (Mesclagem média 20h 34m) (14 fundiu PRs em 30d)

Description

Q A
Bug or feature request? Feature
Which Swagger/OpenAPI version? Any
Which Swagger-UI version? 3.23.1
How did you install Swagger-UI? Hosting the dist folder
Which browser & version? Any
Which operating system? Any

Thanks to #3649, now the API name is used to generate a direct link to that API, also fixing the deep linking problem when multiple APIs are present. The API name becomes a parameter in the URL, as it is visible in the drop-down list when the Swagger UI renders multiple API definitions.

I'm proposing to add a new optional property in the list of the API definitions, next to name or primaryName, called displayName (eventually also primaryDisplayName) to be solely used as visible text in the drop-down.

Having friendly API names like "Customer look-up v1" generates URLs with escaped characters. Changing the API name would also break links. The APIs should be named "customer-lookup-v1" to fix and make the URL more robust, but then the drop-down doesn't look as human-friendly as before.

My proposal is to introduce a new parameter to fix the (cosmetic) display issue.

Guia do colaborador