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

update swagger

parent 97e2686e
No related branches found
No related tags found
1 merge request!28Swagger
package gov.usgs.earthquake.nshmp.netcdf.swagger; package gov.usgs.earthquake.nshmp.netcdf.swagger;
import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileReader; import java.io.FileReader;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.Map; import java.util.Map;
import java.util.Properties;
import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.Yaml;
import com.google.common.io.Resources;
import gov.usgs.earthquake.nshmp.netcdf.NshmGroup; import gov.usgs.earthquake.nshmp.netcdf.NshmGroup;
import io.swagger.v3.oas.models.PathItem; import io.swagger.v3.oas.models.PathItem;
/** /**
* Create Swagger files for each model and update context path. * Create Swagger files for each model and update context path.
*
* @author U.S. Geological Survey
*/ */
class UpdateSwagger { class UpdateSwagger {
private static final URL SWAGGER_URL = Resources.getResource("swagger");
private static final Path SWAGGER_DIR = Paths.get("swagger-files"); private static final Path SWAGGER_DIR = Paths.get("swagger-files");
private static final Path TARGET_FILE; private static final Path TARGET_FILE;
private static final String OPENAPI_TARGET = "micronaut.openapi.target.file";
static { static {
try { try (var file = new FileInputStream("openapi.properties")) {
var dir = Paths.get(SWAGGER_URL.toURI()); var properties = new Properties();
TARGET_FILE = dir.resolve("netcdf-swagger.yml"); properties.load(file);
} catch (URISyntaxException e) { var openapi = properties.getProperty(OPENAPI_TARGET);
TARGET_FILE = Paths.get(openapi);
} catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
......
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