This guide will help you get started with Apicurio Codegen and generate your first Java code from an OpenAPI specification.
Before you begin, ensure you have:
The primary way to use Apicurio Codegen is through the Maven plugin. Add the following to your pom.xml:
<build>
<plugins>
<plugin>
<groupId>io.apicurio</groupId>
<artifactId>apicurio-codegen-maven-plugin</artifactId>
<version>${apicurio-codegen.version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<spec>${project.basedir}/src/main/resources/openapi.yaml</spec>
<output>${project.build.directory}/generated-sources/apicurio</output>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Then run:
mvn clean compile
The generated code will be available in target/generated-sources/apicurio.
You can customize the code generation through various configuration options in the plugin:
For a complete working example, check out the sample project in the Apicurio Codegen repository.