@Override public JsonNode asJson() throws GenerationException { try { return new OpenApiNormalizer(normalizerOptions).of(json).normalizeToJson(inFile.toURI().toURL()); } catch (IOException e) { throw new GenerationException("Failed to normalize model spec: " + inFile, e); } }
private OpenApi<?> kaizenParse() throws GenerationException { try { return new OpenApiNormalizer(normalizerOptions).of(json).normalizeToKaizen(inFile.toURI().toURL()); } catch (IOException e) { throw new GenerationException("Failed to parse OpenAPI document: " + inFile, e); } }
private OpenAPI openAPIParse() throws GenerationException { try { return new OpenApiNormalizer(normalizerOptions).of(json).normalizeToOpenAPI(inFile.toURI().toURL()); } catch (Exception e) { throw new GenerationException("Failed to parse OpenApi2 document: " + inFile, e); } }
private Swagger swaggerParse() throws GenerationException { try { return new OpenApiNormalizer(normalizerOptions).of(json).normalizeToSwagger(inFile.toURI().toURL()); } catch (Exception e) { throw new GenerationException("Failed to parse Swagger2 document: " + inFile, e); } }
public JsonNode normalizeToJson() throws IOException, GenerationException { return normalizeToJson((URL) null); }
public JsonNode normalizeToJson(URL resolutionBase) throws IOException, GenerationException { long start = System.nanoTime(); try { resolutionBase = checkArgs(resolutionBase); debug("Normalizer Start", resolutionBase, Thread.currentThread().getStackTrace(), spec != null ? spec : tree); JsonNode normalized = normalizeToJsonInternal(resolutionBase); if (!options.isDeferExtensionDataRemoval()) { OpenApiMarkers.removeMarkers(normalized, options); } debug(FINAL_SPEC, "Normalized model spec", normalized); return normalized; } catch (IOException | GenerationException e) { debug(e); throw e; } finally { long elapsed = (System.nanoTime() - start) / (1000 * 1000); // milliseconds debug(String.format("Normalizer End [%d.%03dsec]", elapsed / 1000, (elapsed % 1000))); } }
public OpenApi<?> normalizeToKaizen() throws IOException, GenerationException { return normalizeToKaizen((URL) null); }
public Swagger normalizeToSwagger() throws IOException, GenerationException { return normalizeToSwagger((URL) null); }
public OpenAPI normalizeToOpenAPI() throws IOException, GenerationException { return normalizeToOpenAPI((URL) null); }
public OpenApi<?> normalizeToKaizen(URL resolutionBase) throws IOException, GenerationException { String baseUrlString = new Reference(resolutionBase, options.getModelVersion()).getCanonicalFileRefString(); options.resolveScope(baseUrlString); debug("Normalizer Start", resolutionBase, Thread.currentThread().getStackTrace(), spec != null ? spec : tree); long start = System.nanoTime(); tree = normalizeToJsonInternal(resolutionBase); try { debug(NormalizerDebug.Option.PRE_PARSE_SPEC, tree); String spec = mapper.writeValueAsString(tree); return new OpenApiParser().parse(spec, resolutionBase, true); } catch (Exception e) { debug(e); throw e; } finally { long elapsed = (System.nanoTime() - start) / (1000 * 1000); // milliseconds debug(String.format("Normalizer End [%d.%03dsec]", elapsed / 1000, (elapsed % 1000))); } }
@Override public Swagger load(File inFile) throws GenerationException { Swagger swagger; try { swagger = new OpenApiNormalizer(getNormalizerOptions()).of(inFile).normalizeToSwagger(inFile); } catch (Exception e) { throw new GenerationException("Failed to parse Swagger spec: " + inFile, e); } if (swagger != null) { return swagger; } else { throw new GenerationException("File does not contain a valid Swagger spec: " + inFile); } }
public JsonNode normalizeToJson(String resolutionBase) throws IOException, GenerationException { return normalizeToJson(new URL(resolutionBase)); }
public OpenApi<?> normalizeToKaizen(String resolutionBase) throws IOException, GenerationException { return normalizeToKaizen(new URL(resolutionBase)); }
public Swagger normalizeToSwagger(String resolutionBase) throws IOException, GenerationException { return normalizeToSwagger(new URL(resolutionBase)); }
public OpenAPI normalizeToOpenAPI(String resolutionBase) throws IOException, GenerationException { return normalizeToOpenAPI(new URL(resolutionBase)); }
debug("Normalizer Start", resolutionBase, Thread.currentThread().getStackTrace(), spec != null ? spec : tree); long start = System.nanoTime(); tree = normalizeToJsonInternal(resolutionBase);
@Override public JsonNode asJson() throws GenerationException { try { return new OpenApiNormalizer(normalizerOptions).of(json).normalizeToJson(inFile.toURI().toURL()); } catch (IOException e) { throw new GenerationException("Failed to normalize model spec: " + inFile, e); } }
private OpenAPI openAPIParse() throws GenerationException { try { return new OpenApiNormalizer(normalizerOptions).of(json).normalizeToOpenAPI(inFile.toURI().toURL()); } catch (Exception e) { throw new GenerationException("Failed to parse OpenApi2 document: " + inFile, e); } }
@Override public OpenApi3 load(File inFile) throws GenerationException { OpenApi3 model; try { model = (OpenApi3) new OpenApiNormalizer(OPENAPI3_MODEL_VERSION, getNormalizerOptions()).of(inFile) .normalizeToKaizen(inFile); } catch (Exception e) { throw new GenerationException("Failed to parse Swagger spec: " + inFile, e); } if (model != null && model.isValid()) { return model; } else { throw new GenerationException("File does not contain a valid Swagger spec: " + inFile); } }
public JsonNode normalizeToJson(File resolutionBase) throws IOException, GenerationException { return normalizeToJson(resolutionBase.toURI().toURL()); }