feat(managed): JSON schema for delivery configs
MODIFY
gate-core/src/main/java/com/netflix/spinnaker/gate/services/internal/KeelService.java
gate-core/src/main/java/com/netflix/spinnaker/gate/services/internal/KeelService.java
@@ -75,6 +75,9 @@ public interface KeelService {
@POST("/delivery-configs/diff")
List<Map> diffManifest(@Body DeliveryConfig manifest);
+ @GET("/delivery-configs/schema")
+ Map<String, Object> schema();
+
@POST("/delivery-configs/validate")
@Headers("Accept: application/json")
Map validateManifest(@Body DeliveryConfig manifest);
@@ -145,9 +148,6 @@ public interface KeelService {
@Path("reference") String reference,
@Path("version") String version);
- @GET("/v3/api-docs")
- Map<String, Object> getApiDocs();
-
@GET("/installedPlugins")
List<SpinnakerPluginDescriptor> getInstalledPlugins();
}

MODIFY
gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ManagedController.java
gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/ManagedController.java
@@ -207,6 +207,14 @@ public class ManagedController {
return keelService.diffManifest(manifest);
}
+ @ApiOperation(value = "Ad-hoc validate and diff a config manifest", response = Map.class)
+ @GetMapping(
+ path = "/delivery-configs/schema",
+ produces = {APPLICATION_JSON_VALUE, APPLICATION_YAML_VALUE})
+ Map<String, Object> schema() {
+ return keelService.schema();
+ }
+
@ApiOperation(
value = "List up-to {limit} current constraint states for an environment",
response = ConstraintState.class)
@@ -302,9 +310,4 @@ public class ManagedController {
@PathVariable("version") String version) {
keelService.deleteVeto(application, targetEnvironment, reference, version);
}
-
- @GetMapping(path = "/api-docs")
- Map<String, Object> getApiDocs() {
- return keelService.getApiDocs();
- }
}

DELETE
gate-web/src/main/java/com/netflix/spinnaker/gate/config/SwaggerEndpointsConfig.java
-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;
- };
- }
-}

feat(managed): JSON schema for delivery configs (#1341)