-
Notifications
You must be signed in to change notification settings - Fork 739
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(managed-delivery): Integrate keel API docs into Swagger (#1211)
- Loading branch information
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
gate-web/src/main/java/com/netflix/spinnaker/gate/config/SwaggerEndpointsConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; | ||
} | ||
} |