swagger-api / swagger-api/swagger-codegen
[JAVA] Refs with depth greater than 2 are not resolved properly
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Refs having file depth greater than 2 are not resolved properly.
Swagger-codegen version
2.4.6
Swagger declaration file content or url
First file (test.yaml)
definitions:
test:
type: 'object'
properties:
test:
$ref: 'test2.yaml#/definitions/MyTestCluster'
Second file (test2.yaml)
definitions:
MyTestCluster:
$ref: 'test3.yaml#/definitions/my.test.Cluster'
Third file (test3.yaml)
definitions:
my.test.Cluster:
type: 'object'
properties:
value:
type: 'integer'
format: 'int64'
Command line used for generation
java -jar swagger-codegen-cli.jar generate -l java -i test.yaml -o out/
Steps to reproduce
Create 3 files with refs chaining from the first file to the third and try to generate java code.
Suggest a fix/enhancement
Will try to debug, for now it look like there's a problem in DefinitionsProcessor.processDefinitions method.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with DefinitionsProcessor.processDefinitions and reproduce the issue using the three linked YAML files and the Java generation command. Trace the chained refs from test.yaml through test2.yaml to test3.yaml; done means the third-level definition resolves and Java code generation succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100