Skip to content
Snippets Groups Projects
Commit 50dd8f9f authored by Clayton, Brandon Scott's avatar Clayton, Brandon Scott
Browse files

handle local swagger

parent 999b4330
No related branches found
No related tags found
1 merge request!816GMM Services
......@@ -59,9 +59,14 @@ public class SwaggerController {
HazardModel model) {
var openApi = new OpenAPIV3Parser().read("META-INF/swagger/nshmp-haz.yml");
if (gmmDeploy && ServletUtil.awsRuntime.isPresent()) {
openApi = gmmSwagger(openApi);
} else if (ServletUtil.awsRuntime.isPresent()) {
if (ServletUtil.awsRuntime.isPresent()) {
if (gmmDeploy) {
openApi = gmmSwagger(openApi);
} else {
openApi = hazardSwagger(openApi, model);
filterGmms(openApi);
}
} else {
openApi = hazardSwagger(openApi, model);
}
......@@ -70,6 +75,25 @@ public class SwaggerController {
return openApi;
}
/**
* Filter GMM services.
*
* @param openApi OpenAPI docs.
*/
private void filterGmms(OpenAPI openApi) {
Paths paths = new Paths();
openApi.getPaths().forEach((path, pathItem) -> {
if (!path.contains("/gmm")) {
paths.put(path, pathItem);
}
});
openApi.paths(paths);
openApi.setTags(openApi.getTags().stream()
.filter(tag -> !tag.getName().contains("Ground Motion Models"))
.collect(Collectors.toList()));
}
/**
* Filter all services except GMM.
*
......@@ -102,17 +126,6 @@ public class SwaggerController {
* @param model The current model.
*/
private OpenAPI hazardSwagger(OpenAPI openApi, HazardModel model) {
Paths paths = new Paths();
openApi.getPaths().forEach((path, pathItem) -> {
if (!path.contains("/gmm")) {
paths.put(path, pathItem);
}
});
openApi.paths(paths);
openApi.setTags(openApi.getTags().stream()
.filter(tag -> !tag.getName().contains("Ground Motion Models"))
.collect(Collectors.toList()));
var bounds = model.bounds();
var components = openApi.getComponents();
var schemas = components.getSchemas();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment