public void initialize(String urlPath, ServerMetadata data) { String swaggerPath = getPath(urlPath); for (RouteMetadata route : data.getRoutes()) { String path = getPath(route.getUri().getPattern()); if (swaggerPath.equals(path)) continue; ApiDeclarations apis = apisByPath.get(path); if (apis == null) // new path to document { apis = new ApiDeclarations(resources, server, path); apisByPath.put(path, apis); // TODO: pull the description from the route metadata (not // currently available). resources.addApi(path, null); } apis.addApi(new ApiDeclaration(route)); // apis.addModels(); } }
public ApiDeclarations(ApiResources api, RestExpress server, String path) { this.apiVersion = api.getApiVersion(); this.swaggerVersion = api.getSwaggerVersion(); this.basePath = server.getBaseUrl(); this.resourcePath = path; }