[BUG] Schema $ref with same name is not producing models properly
Created by: vinodchitrali
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
What's the version of OpenAPI Generator used? -
Have you search for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Bounty to sponsor the fix (example)
Description
My schema definition are spread across multiple files and they are cross reference(using $ref). In these files there is one schema with same name. I have 5 such instances
When i run code generator, Only 2 models are produced. Rest are ignored. Some of the $ref are pointing to wrong model.
Here is example given below
openapi-generator version
4.0.0-beta
OpenAPI declaration file content or url
https://gist.github.com/vinodchitrali/c5cd3be1c8d6fb0d2fb6bcf6a530ad94
Command line used for generation
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i ./api/openapi.yaml -g python -o /tmp/python/ --api-package api --model-package model --additional-properties projectName=python
Steps to reproduce
- Copy the Yaml files from https://gist.github.com/vinodchitrali/c5cd3be1c8d6fb0d2fb6bcf6a530ad94
- java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i ./api/openapi.yaml -g python -o /tmp/python/ --api-package api --model-package model --additional-properties projectName=python
- Check files generated in /tmp/python/openapi_client/model/