Skip to content

Commit

Permalink
docs(managed-delivery): Integrate keel API docs into Swagger (#1211)
Browse files Browse the repository at this point in the history
  • Loading branch information
luispollo committed May 20, 2020
1 parent e4b9dc4 commit 8b4de79
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,7 @@ Response deleteVeto(
@Path("targetEnvironment") String targetEnvironment,
@Path("reference") String reference,
@Path("version") String version);

@GET("/v3/api-docs")
Map<String, Object> getApiDocs();
}
Original file line number Diff line number Diff line change
Expand Up @@ -276,4 +276,9 @@ void deleteVeto(
@PathVariable("version") String version) {
keelService.deleteVeto(application, targetEnvironment, reference, version);
}

@GetMapping(path = "/api-docs")
Map<String, Object> getApiDocs() {
return keelService.getApiDocs();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.netflix.spinnaker.gate.config;

import java.util.ArrayList;
import java.util.List;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import springfox.documentation.swagger.web.InMemorySwaggerResourcesProvider;
import springfox.documentation.swagger.web.SwaggerResource;
import springfox.documentation.swagger.web.SwaggerResourcesProvider;

@Configuration
@ConditionalOnProperty("swagger.enabled")
public class SwaggerEndpointsConfig {

@Primary
@Bean
public SwaggerResourcesProvider swaggerResourcesProvider(
InMemorySwaggerResourcesProvider defaultResourcesProvider) {
return () -> {
SwaggerResource keelApiDocs = new SwaggerResource();
keelApiDocs.setName("keel");
keelApiDocs.setSwaggerVersion("3.0");
keelApiDocs.setLocation("/managed/api-docs");

List<SwaggerResource> resources = new ArrayList<>(defaultResourcesProvider.get());
resources.add(keelApiDocs);
return resources;
};
}
}

0 comments on commit 8b4de79

Please sign in to comment.