Search in sources :

Example 1 with OpenApiDocument

use of org.wildfly.swarm.microprofile.openapi.api.OpenApiDocument in project wildfly-swarm by wildfly-swarm.

the class OpenApiDeploymentProcessor method process.

/**
 * Process the deployment in order to produce an OpenAPI document.
 *
 * @see org.wildfly.swarm.spi.api.DeploymentProcessor#process()
 */
@Override
public void process() throws Exception {
    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);
    }
    // Set models from annotations and static file
    OpenApiDocument openApiDocument = OpenApiDocument.INSTANCE;
    openApiDocument.config(config);
    openApiDocument.modelFromStaticFile(modelFromStaticFile());
    openApiDocument.modelFromAnnotations(modelFromAnnotations());
}
Also used : OpenApiDocument(org.wildfly.swarm.microprofile.openapi.api.OpenApiDocument) WARArchive(org.wildfly.swarm.undertow.WARArchive) IOException(java.io.IOException)

Example 2 with OpenApiDocument

use of org.wildfly.swarm.microprofile.openapi.api.OpenApiDocument in project wildfly-swarm by wildfly-swarm.

the class OpenApiServletContextListener method contextInitialized.

@Override
public void contextInitialized(ServletContextEvent sce) {
    // Instantiate OASModelReader and OASFilter
    OpenApiDocument openApiDocument = OpenApiDocument.INSTANCE;
    openApiDocument.modelFromReader(modelFromReader());
    openApiDocument.filter(getFilter());
    // Now we're ready to initialize the final model
    openApiDocument.initialize();
}
Also used : OpenApiDocument(org.wildfly.swarm.microprofile.openapi.api.OpenApiDocument)

Aggregations

OpenApiDocument (org.wildfly.swarm.microprofile.openapi.api.OpenApiDocument)2 IOException (java.io.IOException)1 WARArchive (org.wildfly.swarm.undertow.WARArchive)1