Search in sources :

Example 1 with ConfigPropertyProcessor

use of fish.payara.microprofile.openapi.impl.processor.ConfigPropertyProcessor in project Payara by payara.

the class OpenAPISupplier method get.

@Override
public synchronized OpenAPI get() {
    if (this.document != null) {
        return this.document;
    }
    if (!enabled) {
        return null;
    }
    try {
        final Parser parser = Globals.get(ApplicationLifecycle.class).getDeployableParser(archive, true, true, StructuredDeploymentTracing.create(applicationId), Logger.getLogger(OpenApiService.class.getName()));
        final Types types = parser.getContext().getTypes();
        OpenAPI doc = new OpenAPIImpl();
        try {
            final List<URL> baseURLs = getServerURL(contextRoot);
            doc = new ConfigPropertyProcessor().process(doc, config);
            doc = new ModelReaderProcessor().process(doc, config);
            doc = new FileProcessor(classLoader).process(doc, config);
            doc = new ApplicationProcessor(types, filterTypes(archive, config, types), classLoader).process(doc, config);
            doc = new BaseProcessor(baseURLs).process(doc, config);
            doc = new FilterProcessor().process(doc, config);
        } finally {
            this.document = doc;
        }
        return this.document;
    } catch (Exception ex) {
        throw new RuntimeException("An error occurred while creating the OpenAPI document.", ex);
    }
}
Also used : Types(org.glassfish.hk2.classmodel.reflect.Types) FileProcessor(fish.payara.microprofile.openapi.impl.processor.FileProcessor) OpenAPIImpl(fish.payara.microprofile.openapi.impl.model.OpenAPIImpl) FilterProcessor(fish.payara.microprofile.openapi.impl.processor.FilterProcessor) ApplicationLifecycle(com.sun.enterprise.v3.server.ApplicationLifecycle) ModelReaderProcessor(fish.payara.microprofile.openapi.impl.processor.ModelReaderProcessor) URL(java.net.URL) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) MultiException(org.glassfish.hk2.api.MultiException) Parser(org.glassfish.hk2.classmodel.reflect.Parser) ConfigPropertyProcessor(fish.payara.microprofile.openapi.impl.processor.ConfigPropertyProcessor) ApplicationProcessor(fish.payara.microprofile.openapi.impl.processor.ApplicationProcessor) OpenAPI(org.eclipse.microprofile.openapi.models.OpenAPI) BaseProcessor(fish.payara.microprofile.openapi.impl.processor.BaseProcessor)

Aggregations

ApplicationLifecycle (com.sun.enterprise.v3.server.ApplicationLifecycle)1 OpenAPIImpl (fish.payara.microprofile.openapi.impl.model.OpenAPIImpl)1 ApplicationProcessor (fish.payara.microprofile.openapi.impl.processor.ApplicationProcessor)1 BaseProcessor (fish.payara.microprofile.openapi.impl.processor.BaseProcessor)1 ConfigPropertyProcessor (fish.payara.microprofile.openapi.impl.processor.ConfigPropertyProcessor)1 FileProcessor (fish.payara.microprofile.openapi.impl.processor.FileProcessor)1 FilterProcessor (fish.payara.microprofile.openapi.impl.processor.FilterProcessor)1 ModelReaderProcessor (fish.payara.microprofile.openapi.impl.processor.ModelReaderProcessor)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 UnknownHostException (java.net.UnknownHostException)1 OpenAPI (org.eclipse.microprofile.openapi.models.OpenAPI)1 MultiException (org.glassfish.hk2.api.MultiException)1 Parser (org.glassfish.hk2.classmodel.reflect.Parser)1 Types (org.glassfish.hk2.classmodel.reflect.Types)1