@Override protected List<ImmutablePair<String, String>> getKnownLocations() { List<ImmutablePair<String, String>> locations = new LinkedList<>(Arrays.asList( new ImmutablePair<>("servlet", ServletConfigContextUtils.OPENAPI_CONFIGURATION_LOCATION_KEY), new ImmutablePair<>("servletpath", "openapi-configuration.yaml"), new ImmutablePair<>("servletpath", "openapi-configuration.json"), new ImmutablePair<>("servletpath", "WEB-INF/openapi-configuration.yaml"), new ImmutablePair<>("servletpath", "WEB-INF/openapi-configuration.json"), new ImmutablePair<>("servletpath", "openapi.yaml"), new ImmutablePair<>("servletpath", "openapi.json"), new ImmutablePair<>("servletpath", "WEB-INF/openapi.yaml"), new ImmutablePair<>("servletpath", "WEB-INF/openapi.json") )); locations.addAll(super.getKnownLocations()); locations.add(new ImmutablePair<>("servlet", "")); // get config from init params return locations; }
@Override protected Map<String, OpenApiConfigurationLoader> getLocationLoaders() { Map<String, OpenApiConfigurationLoader> map = super.getLocationLoaders(); map.put("servlet", new ServletOpenApiConfigurationLoader(servletConfig)); map.put("servletpath", new ServletPathConfigurationLoader(servletConfig)); return map; }
@Override public OpenApiContext buildContext(boolean init) throws OpenApiConfigurationException { if (StringUtils.isBlank(ctxId)) { ctxId = OpenApiContext.OPENAPI_CONTEXT_ID_DEFAULT; } OpenApiContext ctx = OpenApiContextLocator.getInstance().getOpenApiContext(ctxId); if (ctx == null) { OpenApiContext rootCtx = OpenApiContextLocator.getInstance().getOpenApiContext(OpenApiContext.OPENAPI_CONTEXT_ID_DEFAULT); ctx = new XmlWebOpenApiContext() .servletConfig(servletConfig) .app(application) .openApiConfiguration(openApiConfiguration) .id(ctxId) .parent(rootCtx); if (ctx.getConfigLocation() == null && configLocation != null) { ((XmlWebOpenApiContext) ctx).configLocation(configLocation); } if (((XmlWebOpenApiContext) ctx).getResourcePackages() == null && resourcePackages != null) { ((XmlWebOpenApiContext) ctx).resourcePackages(resourcePackages); } if (((XmlWebOpenApiContext) ctx).getResourceClasses() == null && resourceClasses != null) { ((XmlWebOpenApiContext) ctx).resourceClasses(resourceClasses); } if (init) { ctx.init(); // includes registering itself with OpenApiContextLocator } } return ctx; }
@Override public OpenApiContext buildContext(boolean init) throws OpenApiConfigurationException { if (StringUtils.isBlank(ctxId)) { ctxId = OpenApiContext.OPENAPI_CONTEXT_ID_DEFAULT; } OpenApiContext ctx = OpenApiContextLocator.getInstance().getOpenApiContext(ctxId); if (ctx == null) { OpenApiContext rootCtx = OpenApiContextLocator.getInstance().getOpenApiContext(OpenApiContext.OPENAPI_CONTEXT_ID_DEFAULT); ctx = new XmlWebOpenApiContext() .servletConfig(servletConfig) .app(application) .openApiConfiguration(openApiConfiguration) .id(ctxId) .parent(rootCtx); if (ctx.getConfigLocation() == null && configLocation != null) { ((XmlWebOpenApiContext) ctx).configLocation(configLocation); } if (((XmlWebOpenApiContext) ctx).getResourcePackages() == null && resourcePackages != null) { ((XmlWebOpenApiContext) ctx).resourcePackages(resourcePackages); } if (((XmlWebOpenApiContext) ctx).getResourceClasses() == null && resourceClasses != null) { ((XmlWebOpenApiContext) ctx).resourceClasses(resourceClasses); } if (init) { ctx.init(); // includes registering itself with OpenApiContextLocator } } return ctx; }
@Override protected Map<String, OpenApiConfigurationLoader> getLocationLoaders() { Map<String, OpenApiConfigurationLoader> map = super.getLocationLoaders(); map.put("servlet", new ServletOpenApiConfigurationLoader(servletConfig)); map.put("servletpath", new ServletPathConfigurationLoader(servletConfig)); return map; }
@Override protected List<ImmutablePair<String, String>> getKnownLocations() { List<ImmutablePair<String, String>> locations = new LinkedList<>(Arrays.asList( new ImmutablePair<>("servlet", ServletConfigContextUtils.OPENAPI_CONFIGURATION_LOCATION_KEY), new ImmutablePair<>("servletpath", "openapi-configuration.yaml"), new ImmutablePair<>("servletpath", "openapi-configuration.json"), new ImmutablePair<>("servletpath", "WEB-INF/openapi-configuration.yaml"), new ImmutablePair<>("servletpath", "WEB-INF/openapi-configuration.json"), new ImmutablePair<>("servletpath", "openapi.yaml"), new ImmutablePair<>("servletpath", "openapi.json"), new ImmutablePair<>("servletpath", "WEB-INF/openapi.yaml"), new ImmutablePair<>("servletpath", "WEB-INF/openapi.json") )); locations.addAll(super.getKnownLocations()); locations.add(new ImmutablePair<>("servlet", "")); // get config from init params return locations; }