openapiquarkus

Quarkus Openapi extension : Get the generated openapi yml file at build time


In order to generate client library, I would to get the Quarkus generated openapi yml file at build time.

For now the only way I found to get it is running the server and get it from the /q/openapi endpoint but it is overkill in the process to have to run the server just to have the spec yml file.

This file will be used as input to generate client libs with generators in CI.


Solution

  • You can set the following property:

    quarkus.smallrye-openapi.store-schema-directory
    

    in the application.properties of the server

    Example:

    quarkus.smallrye-openapi.store-schema-directory=target/generated/
    

    will store it relative to your project folder under target/generated.

    Both the json and yaml version will be stored.

    See https://quarkus.io/guides/openapi-swaggerui#quarkus-smallrye-openapi_quarkus.smallrye-openapi.store-schema-directory