Problem
Currently, when displayAllServers is false (the default), only a single server URL is shown - the first one with production: true, or the first server in the array. There is no way to display multiple production endpoints while hiding non-production ones.
This is a problem when an API exposes multiple endpoints for the same environment, e.g. a GraphQL HTTP endpoint and a WebSocket endpoint. The AWS AppSync GraphQL does that for example:
servers:
- url: https://dev.example.com/graphql
description: Dev GraphQL
- url: wss://dev.example.com/realtime
description: Dev WebSocket
- url: https://example.com/graphql
description: GraphQL API
production: true
- url: wss://example.com/realtime
description: WebSocket
production: true
With the current behavior, only https://example.com/graphql is displayed. Setting displayAllServers: true would show all four servers, including the dev ones.
Expected behavior
When displayAllServers is false and multiple servers have production: true, all production servers should be displayed with their descriptions - not just the first one.
Proposed solution
In src/themes/default/helpers/generateApiEndpoints.js, filter servers by production: true when there are multiple production entries, and render them in the same format used by displayAllServers: true. When only one (or zero) servers have production: true, the existing behavior is preserved - no breaking change.
Problem
Currently, when
displayAllServersisfalse(the default), only a single server URL is shown - the first one withproduction: true, or the first server in the array. There is no way to display multiple production endpoints while hiding non-production ones.This is a problem when an API exposes multiple endpoints for the same environment, e.g. a GraphQL HTTP endpoint and a WebSocket endpoint. The AWS AppSync GraphQL does that for example:
With the current behavior, only
https://example.com/graphqlis displayed. SettingdisplayAllServers: truewould show all four servers, including the dev ones.Expected behavior
When
displayAllServersisfalseand multiple servers haveproduction: true, all production servers should be displayed with their descriptions - not just the first one.Proposed solution
In
src/themes/default/helpers/generateApiEndpoints.js, filter servers byproduction: truewhen there are multiple production entries, and render them in the same format used bydisplayAllServers: true. When only one (or zero) servers haveproduction: true, the existing behavior is preserved - no breaking change.