Java Code Examples for io.smallrye.openapi.api.OpenApiDocument#config()
The following examples show how to use
io.smallrye.openapi.api.OpenApiDocument#config() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JaxRsAnnotationScannerTest.java From smallrye-open-api with Apache License 2.0 | 6 votes |
@Test public void testTagScanning_OrderGivenStaticFile() throws IOException, JSONException { Index i = indexOf(TagTestResource1.class, TagTestResource2.class); OpenApiAnnotationScanner scanner = new OpenApiAnnotationScanner(nestingSupportConfig(), i); OpenAPI scanResult = scanner.scan(); OpenAPI staticResult = OpenApiParser.parse(new ByteArrayInputStream( "{\"info\" : {\"title\" : \"Tag order in static file\",\"version\" : \"1.0.0-static\"},\"tags\": [{\"name\":\"tag3\"},{\"name\":\"tag1\"}]}" .getBytes()), Format.JSON); OpenApiDocument doc = OpenApiDocument.INSTANCE; doc.config(nestingSupportConfig()); doc.modelFromStaticFile(staticResult); doc.modelFromAnnotations(scanResult); doc.initialize(); OpenAPI result = doc.get(); printToConsole(result); assertJsonEquals("resource.tags.ordergiven.staticfile.json", result); }
Example 2
Source File: OpenApiDeploymentProcessor.java From thorntail with Apache License 2.0 | 6 votes |
/** * Process the deployment in order to produce an OpenAPI document. * * @see org.wildfly.swarm.spi.api.DeploymentProcessor#process() */ @Override public void process() throws Exception { // if the deployment is Implicit, we don't want to process it if (deploymentContext != null && deploymentContext.isImplicit()) { return; } try { // First register OpenApiServletContextListener which triggers the final init WARArchive warArchive = archive.as(WARArchive.class); warArchive.findWebXmlAsset().addListener(LISTENER_CLASS); } catch (Exception e) { throw new RuntimeException("Failed to register OpenAPI listener", e); } OpenApiStaticFile staticFile = ArchiveUtil.archiveToStaticFile(archive); // Set models from annotations and static file OpenApiDocument openApiDocument = OpenApiDocument.INSTANCE; openApiDocument.config(config); openApiDocument.modelFromStaticFile(OpenApiProcessor.modelFromStaticFile(staticFile)); openApiDocument.modelFromAnnotations(OpenApiProcessor.modelFromAnnotations(config, index)); }
Example 3
Source File: SmallRyeOpenApiProcessor.java From quarkus with Apache License 2.0 | 4 votes |
private OpenApiDocument createDocument(OpenApiConfig openApiConfig) { OpenApiDocument document = OpenApiDocument.INSTANCE; document.reset(); document.config(openApiConfig); return document; }