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

Created on 12 Mar 2018  路  8Comments  路  Source: swagger-api/swagger-ui

| 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.

Hacktoberfest user experience enhancement

Most helpful comment

Reopening as an improvement request!

All 8 comments

Ciao @ragazzojp

Changes to the "API definition" OAS should be requested here:
https://github.com/OAI/OpenAPI-Specification

@ragazzojp just to clarify - do you mean something like this? --

const ui = SwaggerUIBundle({
  urls: [
    {
      url: "http://my.api.com/swagger.json",
      name: "customer-lookup-v1",
      // TODO new parameter:
      displayName: "MyAwesomeService Customer Lookup API v. 1.0.0"    // <----- ??
    },
   ...

Ciao @heldersepu, I'm not requesting a change in the OAS, I'm proposing just an improvement in the swagger UI. Exactly what @hkosova formulated.

I stand corrected!

Looks like this is already implemented in the urls parameter. If something is missing, please add another comment here.

I think we should reopen because even in version 3.18 I don't think we have this feature implemented. What I'm proposing is to have a displayName field in urls, next to url and name, to display a different text in the drop-down list, than its actual name, that would still be used as identifier, for deep-linking, and so on.

Exactly as @hkosova wrote.

@webron , I think this should be reopened, can you please answer my previous message or show an example of how to use the feature? The documentation does not yet mention any displayName field or similar, but you're saying it is already implemented.

Reopening as an improvement request!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

domaalex picture domaalex  路  34Comments

peter004 picture peter004  路  49Comments

newtechfellas picture newtechfellas  路  47Comments

marlandy picture marlandy  路  53Comments

reginaldlouis picture reginaldlouis  路  43Comments