[JAVA] Problem with duplicate schema names when using external references
Created by: emreakca
Description
The external reference from child to ../openapi.yaml#/components/schemas/Parent doesn't resolve correctly. It creates a empty Parent2.java class and references to Parent2. The code works just fine with the Swagger UI and parsing/validating is also not a problem.
openapi-generator version
3.1.0 / 4.0.x
OpenAPI declaration file content or url
openapi.yaml
components:
schemas:
Parent:
$ref: './components/parent.yaml#/Parent'
Child:
$ref: './components/child.yaml#/Child'
parent.yaml
Parent:
title: parent
type: object
properties:
id:
type: string
description: ID of the resource
child.yaml
Child:
title: Child
allOf:
- $ref: '../openapi.yaml#/components/schemas/Parent'
type: object
properties:
name:
type: string
description: Name of the child
Complete Upload --> https://gist.github.com/emreakca/7291275cfba475d3f6384b92cdfb4554
Command line used for generation
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i ./openapi.yaml -g java -o ./out/java-family-api
Steps to reproduce
Generate client.
Suggest a fix/enhancement
The openapi-generator should generate the code correctly.