Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nshmp-haz
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ghsc
National Seismic Hazard Model Project
nshmp-haz
Commits
50dd8f9f
Commit
50dd8f9f
authored
1 week ago
by
Clayton, Brandon Scott
Browse files
Options
Downloads
Patches
Plain Diff
handle local swagger
parent
999b4330
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!816
GMM Services
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/gov/usgs/earthquake/nshmp/www/SwaggerController.java
+27
-14
27 additions, 14 deletions
...java/gov/usgs/earthquake/nshmp/www/SwaggerController.java
with
27 additions
and
14 deletions
src/main/java/gov/usgs/earthquake/nshmp/www/SwaggerController.java
+
27
−
14
View file @
50dd8f9f
...
...
@@ -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
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment