-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Closed
Copy link
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
While generating openapi spec with enums having common prefix, the common prefix is skipped in the enum name. Eg:
ResourceTypeV1:
type: string
description: Defines a resource type to provision, it can be multiple resources e.g. DATABASE or TOPIC
enum:
- RESOURCE_ACCESS_REQUEST
- RESOURCE_ACCESS_GRANTClass generated:
public enum ResourceTypeV1 {
REQUEST("RESOURCE_ACCESS_REQUEST"),
GRANT("RESOURCE_ACCESS_GRANT");
private String value;Expected class generated:
public enum ResourceTypeV1 {
RESOURCE_ACCESS_REQUEST("RESOURCE_ACCESS_REQUEST"),
RESOURCE_ACCESS_GRANT("RESOURCE_ACCESS_GRANT");
private String value;openapi-generator version: 7.6.0
OpenAPI declaration file content or url
Generation Details
Using maven to generate. Below is the configuration for the openapi-generator-maven-plugin
<configuration>
<inputSpec>${project.basedir}/src/main/resources/schema/openapi_rar.yaml</inputSpec>
<generatorName>spring</generatorName>
<packageName>com.maersk.relaystream.provisioning.schema.rar</packageName>
<apiPackage>com.maersk.relaystream.provisioning.generated.api.rar</apiPackage>
<modelPackage>com.maersk.relaystream.provisioning.generated.model.rar</modelPackage>
<configOptions>
<sourceFolder>src/gen/java</sourceFolder>
<ignoreAnyOfInEnum>true</ignoreAnyOfInEnum>
<interfaceOnly>true</interfaceOnly>
<useSpringBoot3>true</useSpringBoot3>
<openApiNullable>false</openApiNullable>
<serializableModel>true</serializableModel>
<containerDefaultToNull>false</containerDefaultToNull>
</configOptions>
</configuration>Steps to reproduce
- Create an OpenAPI spec having the enum mentioned above
- Generate the class from the spec.
Related issues/PRs
Suggest a fix
subhidh-agarwal