private URL checkArgs(URL resolutionBase) throws MalformedURLException { if (resolutionBase == null) { // null resolution base should never be null unless the provided // spec is free of relative references. // But just in case, we use a dummy URL that is extremely // unlikely to lead to successful resolution of // relative references URLs resolutionBase = new URL("file:/../n/o/r/e/s/o/l/u/t/i/o/n/b/a/s/e/p/r/o/v/i/d/e/d/"); } String baseUrlString = new Reference(resolutionBase, SWAGGER_MODEL_VERSION).getCanonicalFileRefString(); options.resolveScope(baseUrlString); if (spec == null && tree == null) { throw new IllegalStateException("Cannot call normalize() before supplying a model spec"); } return resolutionBase; }
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))); } }
public OpenAPI normalizeToOpenAPI(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();
public Swagger normalizeToSwagger(URL resolutionBase) throws IOException, GenerationException { String baseUrlString = new Reference(resolutionBase, SWAGGER_MODEL_VERSION).getCanonicalFileRefString(); options.resolveScope(baseUrlString); debug("Normalizer Start", resolutionBase, Thread.currentThread().getStackTrace(), spec != null ? spec : tree); long start = System.nanoTime();