Description
Description
I try to move from openapi 3.0.3 to 3.1, but I have a strange behaviour with ref schema.
With 3.0.3 ref schemas are generated (java/spring) with a dedicated Dto, example a schema common.Amount creates a Dto CommonAmount that use as is from all the places.
With 3.1 it now creates a new schema for all the places it’s used.
It’s not related to the generator, but to the parsing: It changed in file OpenAPIV3Parser, L211 if (result.getOpenAPI().getOpenapi() != null && result.getOpenAPI().getOpenapi().startsWith("3.1")) {
I had a maven/springboot project to reproduce it: https://github.com/pkernevez/pb-openapi
The only difference in swaggers “3.0” and “3.1" are the version in the first line.
In my example, I have a share type : common.Amount (a quantity and a currency).
With 3.0.3 I have a shared type CommonAmount, with 3.1 I now have a new type for each usage (here market value).
Why this behaviour changed ?
Is there a way to restore the previous way ?
Having a new class for each usage is an issue to define only once shared code, like mapping Entity <-> Dto
openapi-generator version
Tested with :
- 7.4.0
- 7.5.0-SNAPSHOT on April 11th.
OpenAPI declaration file content or url
- v3.0.3 version
https://github.com/pkernevez/pb-openapi/blob/master/src/main/resources/swagger/accounting-swagger-v3-0.yaml - v3.1.0 version:
https://github.com/pkernevez/pb-openapi/blob/master/src/main/resources/swagger/accounting-swagger-v3-1.yaml
Generation Details
APIs are the same, the issues is for Dtos.

Steps to reproduce
mvn clean install
find target/generated-sources/src/main/java/net/kernevez/generated