-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Labels
Description
Description
I'm trying to generate a groovy model from an openapi spec. Sadly enums are always generated es an empty class. If I use the java generator I get a correct enum with all the defined values inside. So my guess is there is a bug in the groovy generator.
My schema looks like this:
GreetingType:
type: string
enum:
- FRIENDLY
- FORMALand the generated groovy code looks sadly like this:
@Canonical
class GreetingType {
}I was expecting something like:
enum GreetingType {
FRIENDLY,
FORMAL
}
openapi-generator version
6.2.1
OpenAPI declaration file content or url
openapi: 3.0.1
info:
title: test-bas
version: 1.0.0-SNAPSHOT
servers:
- url: http://localhost:8080/
description: Generated server url
paths:
/rest/greet/{name}:
get:
tags:
- rest-service-app
operationId: greet
parameters:
- name: name
in: path
required: true
schema:
type: string
responses:
"200":
description: OK
content:
'*/*':
schema:
$ref: '#/components/schemas/Greeting'
components:
schemas:
Greeting:
type: object
properties:
type:
$ref: '#/components/schemas/GreetingType'
text:
type: string
GreetingType:
type: string
enum:
- FRIENDLY
- FORMAL
Generation Details
I use the maven plugin. These are my settings:
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>6.2.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/resources/openapi.yml</inputSpec>
<generatorName>groovy</generatorName>
<generateApis>false</generateApis>
<generateSupportingFiles>false</generateSupportingFiles>
</configuration>
</execution>
</executions>
</plugin>Steps to reproduce
Use the groovy generator to generate models from an openapi spec with enums
Related issues/PRs
I could not find any...
Suggest a fix
Usable enums please 🙂
Reactions are currently unavailable