stoicflame / enunciate-openapi

OpenAPI3 module for Enunciate
Apache License 2.0
10 stars 10 forks source link

Document maven configuration to run enunciate + encunciate-openapi #24

Closed SKalt closed 4 years ago

SKalt commented 4 years ago

I'm in the process of adding enunciate-openapi to a project which already uses enunciate. I found the maven configuration below got maven to run enunciate-openapi. I say run because encuniate-openapi was unable to process some of the API parameters, a missing feature that I'm in the process of ticketing.

In any case, here's the configuration:

<?xml version="1.0" encoding="UTF-8"?>
<!-- pom.xml -->
<project
    xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
>
    <modelVersion>4.0.0</modelVersion>
    <!-- ... snip ... -->
    <build>
        <!-- ... snip ... -->
        <pluginManagement>
            <!-- ... snip ... -->
            <plugin>
                <groupId>com.webcohesion.enunciate</groupId>
                <artifactId>enunciate-maven-plugin</artifactId>
                <version>2.12.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>docs</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <docsDir>${project.build.directory}</docsDir>
                    <encoding>UTF-8</encoding>
                </configuration>
                <dependencies>
                    <!-- Provides OpenAPI 3 generation -->
                    <dependency>
                        <groupId>dk.jyskebank.tooling.enunciate</groupId>
                        <artifactId>enunciate-openapi</artifactId>
                        <version>1.1.2</version>
                    </dependency>
                </dependencies>
            </plugin>
        </pluginManagement>
    </build>
</project>
<!-- enunciate.xml -->
<enunciate
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://enunciate.webcohesion.com/schemas/enunciate-2.10.1.xsd"
>
    <modules disabledByDefault="true">
        <openapi disabled="false" />
    <jaxrs groupBy="annotation" disabled="false" />
    <jackson disabled="false" />
    <jaxb disabled="false" />
    <jaxrs disabled="false" />
    </modules>
</enunciate>

should allow

mvn --debug enunciate:docs --log ./maven.log
grep -ie 'enabled modules'  ./maven.log 
# [INFO] [ENUNCIATE] Enabled modules: [jackson, jaxb, jaxrs, openapi]
find ./target -name 'openapi.y*ml'
# ./target/openapi.yaml
jskov-jyskebank-dk commented 4 years ago

Sorry, I missed this one. Care to craft a PR with changes to the README?