Search code examples
swaggerswagger-codegenswagger-codegen-maven-pluginopenapi-generator-maven-plugin

openapi-generator-maven-plugin code gen from http


Can we pass input yml specification HTTP URL in openapi-generator-maven-plugin?

I wanted to keep the input specification and generated code in sync.


Solution

  • Yes, with openapi-generator-maven-plugin that is possible by simply giving URL including protocol as inputSpec:

    <plugin>
        <groupId>org.openapitools</groupId>
        <artifactId>openapi-generator-maven-plugin</artifactId>
        <version>5.4.0</version>
        <executions>
            <execution>
                ...
                <configuration>
                    <inputSpec>https://petstore3.swagger.io/api/v3/openapi.yaml</inputSpec>
                    ...
                </configuration>
            </execution>
        </executions>
    </plugin>
    

    Updating plugin version might be necessary.