-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
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
When upgrading to OpenAPI 3.1, some enums are generated as inner enums.
It would be very useful to be able to rename them to the old names. Unfortunately this is not possible
openapi-generator version
7.11.0
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Given these files:
foo.yaml
openapi: 3.0.4
info:
title: foo API
version: 0.0.1
paths:
/foo:
get:
responses:
200:
description: foo
content:
application/json:
schema:
$ref: 'user.yml#/Response'and the shared common.yaml
Response:
properties:
id:
type: integerRunning this will generate two files, one being the shared class:
openapi-generator generate -g java -i foo.yaml
tree src/main/java/org/openapitools/client/model
├── AbstractOpenApiSchema.java
├── Response.java
└── Status.javaBut if you foo.yaml to openapi: 3.1.0, FooGet200Response will be generated. This file can be renamed using modelNameMappings
openapi-generator generate -g java -i foo.yaml --model-name-mappings _foo_get_200_response=Response
tree src/main/java/org/openapitools/client/model
├── AbstractOpenApiSchema.java
└── Response.java
But inside is an Enum, that cannot be renamed:
grep 'enum ' ./src/main/java/org/openapitools/client/model/FooGet200Response.java
public enum StatusEnum {