@Override
    public void rewrite(ProviderContext ctx, Document schema) throws StorageException, GatewayAuthenticationException {
        // Prepare the data we need to extract to build the servers
        ApiVersionBean avb = ctx.getAvb();
        String orgId = avb.getApi().getOrganization().getId();
        String apiId = avb.getApi().getId();
        String apiVersion = avb.getVersion();

        // Find IDs of all GWs this ApiVersion is published onto.
        Set<String> gatewayIds = avb.getGateways().stream()
                                          .map(ApiGatewayBean::getGatewayId)
                                          .collect(Collectors.toUnmodifiableSet());

        Set<ApiEndpointWithDescription> endpoints = new HashSet<>(gatewayIds.size());

        for (GatewayBean gateway : ctx.getStorage().getGateways(gatewayIds)) {
            IGatewayLink link = ctx.getGatewayLinkFactory().create(gateway);
            endpoints.add(new ApiEndpointWithDescription(
                    link.getApiEndpoint(orgId, apiId, apiVersion).getEndpoint(),
                    gateway.getName(),
                    gateway.getDescription()
            ));
        }

        // We can guarantee it's an OAS3.x doc.
        Oas30Document oas3 = (Oas30Document) schema;
        // For now, we just ditch the inbuilt servers and list ours. Later we may do something more intelligent with the user's input.
        if (oas3.servers != null) {
            oas3.servers.clear();
        }
        // Generate new server endpoints with each GW the API Version is published into inserted into the list.
        for (ApiEndpointWithDescription endpoint : endpoints) {
            String nameAndDesc = endpoint.getName();
            if (StringUtils.isNotBlank(endpoint.getDescription())) {
                nameAndDesc += ": " + endpoint.getDescription();
            }
            oas3.addServer(endpoint.getEndpoint(), nameAndDesc);
        }
    }
Remove existing <code>servers</code> sections and instead insert with Apiman Gateway URLs.
Multiple gateways are allowed, so we can insert all of them.
Name and description are incorporated into the description field of the server.

@see <a href="https://swagger.io/specification/">OpenAPI v3 specification</a>
@author Marc Savy {@literal <marc@blackparrotlabs.io>}
manager/api/rest-impl/src/main/java/io/apiman/manager/api/schema/format/OpenApi3.java