v/4b2ed9d
openapi: 3.0.0 info: title: Pets API version: 1.0.0 paths: '/pets': get: operationId: listPets summary: List all pets responses: '200': description: A list of pets content: application/json: schema: type: array items: $ref: '#/components/schemas/Pet' post: operationId: createPet summary: Create a pet requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/Pet' responses: '201': description: Pet created content: application/json: schema: $ref: '#/components/schemas/Pet' '/pets/{petId}': get: operationId: getPet summary: Get a pet by ID parameters: - name: petId in: path required: true schema: type: string responses: '200': description: A single pet content: application/json: schema: $ref: '#/components/schemas/Pet' '404': description: Pet not found components: schemas: Pet: type: object required: - id - name - type properties: id: type: string name: type: string type: type: string enum: - dog - cat age: type: integer
What to generate
genTypes
HTTP_MODELS - Jackson annotated data classes to represent the schema objects defined in the input.
CONTROLLERS - Spring / Micronaut / Ktor HTTP controllers for each of the endpoints defined in the input.
CLIENT - Simple http rest client.
QUARKUS_REFLECTION_CONFIG - This options generates the reflection-config.json file for quarkus integration projects
Model Options
serializationLibrary
JACKSON - Use Jackson 2 for serialization and deserialization
JACKSON_3 - Use Jackson 3 for serialization and deserialization
KOTLINX_SERIALIZATION - Use kotlinx.serialization for serialization and deserialization
modelOptions
X_EXTENSIBLE_ENUMS - This option treats x-extensible-enums as enums
JAVA_SERIALIZATION - This option adds Java Serializable interface to the generated models
QUARKUS_REFLECTION - This option adds @RegisterForReflection to the generated models. Requires dependency "'io.quarkus:quarkus-core:+"
MICRONAUT_INTROSPECTION - This option adds @Introspected to the generated models. Requires dependency "'io.micronaut:micronaut-core:+"
MICRONAUT_REFLECTION - This option adds @ReflectiveAccess to the generated models. Requires dependency "'io.micronaut:micronaut-core:+"
MICRONAUT_SERDEABLE - This option adds @Serdeable to the generated models. Requires dependency "'io.micronaut.serde:micronaut-serde-jackson:+"
INCLUDE_COMPANION_OBJECT - This option adds a companion object to the generated models.
SEALED_INTERFACES_FOR_ONE_OF - This option is deprecated. Sealed interfaces are enabled by default in v26+. Use DISABLE_SEALED_INTERFACES_FOR_ONE_OF to disable.
DISABLE_SEALED_INTERFACES_FOR_ONE_OF - This option disables the default sealed interfaces for oneOf behavior in v26+
NON_NULL_MAP_VALUES - This option makes map values non-null. The default (since v15) and most spec compliant is make map values nullable
FAULT_TOLERANT_ENUMS - This option adds an UNRECOGNIZED enum entry as a fallback for unmapped values, preventing deserialization exceptions. If jackson is used, the deserialization option **READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE** will need to be enabled as well
FAULT_TOLERANT_OPEN_ENUMS - This option converts the "open enum" pattern (an anyOf combining a string enum with an open type: string) into a fault-tolerant enum, i.e. an enum carrying the declared values plus an UNRECOGNIZED fallback, instead of collapsing the type to a plain String. Behaves like FAULT_TOLERANT_ENUMS for the affected enums
modelSuffix
typeOverrides
DATETIME_AS_INSTANT - Use Instant as the datetime type. Defaults to OffsetDateTime
DATETIME_AS_LOCALDATETIME - Use LocalDateTime as the datetime type. Defaults to OffsetDateTime
BYTE_AS_STRING - Ignore string format byte and use String as the type
BINARY_AS_STRING - Ignore string format binary and use String as the type
URI_AS_STRING - Ignore string format uri and use String as the type
UUID_AS_STRING - Ignore string format uuid and use String as the type
DATE_AS_STRING - Ignore string format date and use String as the type
DATETIME_AS_STRING - Ignore string format date-time and use String as the type
BYTEARRAY_AS_INPUTSTREAM - Use InputStream as ByteArray type. Defaults to ByteArray
ANY_AS_JSONELEMENT - Use kotlinx.serialization.json.JsonElement for untyped (any) schemas and JsonObject for untyped objects. Requires the KOTLINX_SERIALIZATION serialization library. Defaults to Any
Client Options
clientTarget
OK_HTTP - Generate OkHttp client.
OPEN_FEIGN - Generate OpenFeign client.
SPRING_HTTP_INTERFACE - Generate Spring HTTP Interface.
KTOR - Generate Ktor client.
clientOptions
RESILIENCE4J - Generates a fault tolerance service for the client using the following library "io.github.resilience4j:resilience4j-all:+" (only for OkHttp clients)
SUSPEND_MODIFIER - This option adds the suspend modifier to the generated client functions (only for OpenFeign clients)
SPRING_RESPONSE_ENTITY_WRAPPER - This option adds the Spring-ResponseEntity generic around the response to be able to get response headers and status (only for OpenFeign clients).
SPRING_CLOUD_OPENFEIGN_STARTER_ANNOTATION - This option adds the @FeignClient annotation to generated client interface
GROUP_BY_TAG - This option groups clients based on the first tag rather than paths
OKHTTP_NON_NULL_RESPONSE_PAYLOADS - This option makes ApiResponse.data non-null. Responses declared with a body must return one: a missing body, or one that deserializes to null, throws ApiException. An operation that declares both a body response and an empty success response (e.g. 200 and 204) throws on the empty success. Binary responses return an empty ByteArray for an empty body (only for OkHttp clients)
Server Options
controllerTarget
SPRING - Generate for Spring framework.
MICRONAUT - Generate for Micronaut framework.
KTOR - Generate for Ktor server.
controllerOptions
SUSPEND_MODIFIER - This option adds the suspend modifier to the generated controller functions
AUTHENTICATION - This option adds the authentication parameter to the generated controller functions
GROUP_BY_TAG - This option groups controllers based on the first tag rather than paths
COMPLETION_STAGE - This option makes generated controller functions have Type CompletionStage
(works only with Spring Controller generator). Can be overridden per operation using the OpenAPI extension x-async-support: true|false
SSE_EMITTER - This option makes generated controller functions have Type SseEmitter (works only with Spring Controller generator)
Validation Options
validationLibrary
JAVAX_VALIDATION - Use javax.validation annotations in generated model classes
JAKARTA_VALIDATION - Use jakarta.validation annotations in generated model classes (default)
NO_VALIDATION - Use no validation annotations in generated model classes
External References
externalRefResolutionMode
TARGETED - Generate models only for directly referenced schemas in external API files.
AGGRESSIVE - Referencing any schema in an external API file triggers generation of every external schema in that file.
Output Options
outputOptions
ADD_FILE_DISCLAIMER - This option adds a disclaimer to the generated files.
// Files will appear here
// Output will appear here