swagger-api / swagger-api/swagger-codegen
[JAVA] Generated API client contains invalid JavaDoc
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I'm using swagger-codegen to generate a client (SDK) for https://api.aixigo.com/apidocs/apidocs/swagger.json (current snapshot attached for reference).
The source code can be compiled and tested via standard Maven package command, but during the attach JavaDoc phase the JavaDoc compiler fails with several wrong, generated comments, i.e.
This one fails because the reference to PmsMeasure must be fully qualified or imported:
[ERROR] /Users/msimons/tmp/generatedcodde/tmp/src/main/java/io/swagger/client/api/ProcessAutomationApi.java:3683: error: reference not found
[ERROR] * This resource consumes {@link PmsTask} and maps them to {@link PmsMeasure} containing the target allocation for the respective contract.
[ERROR]
This one I cannot explain:
[ERROR] /Users/msimons/tmp/generatedcodde/tmp/src/main/java/io/swagger/client/api/RebalancingApi.java:1176: error: unexpected text
[ERROR] * This resource consumes a {@link List< String >} contractIds and maps them to {@link ContractTargetAssetAllocations} containing the target allocations for the respective contract.
This one are invalid entities:
/Users/msimons/tmp/generatedcodde/tmp/src/main/java/io/swagger/client/api/RebalancingApi.java:1181: warning - Tag @link:illegal character: "38" in "List< String >"
Swagger-codegen version
2.3.1, installed via Homebrew
Here are Maven and Java Versions:
mvn --version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T21:39:06+02:00)
Maven home: /usr/local/Cellar/maven/3.5.0/libexec
Java version: 1.8.0_152, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.2", arch: "x86_64", family: "mac"
Swagger declaration file content or url
https://api.aixigo.com/apidocs/apidocs/swagger.json
swagger.json.zip
Command line used for generation
swagger-codegen generate -i https://api.aixigo.com/apidocs/apidocs/swagger.json -l java -o tmp
Steps to reproduce
swagger-codegen generate -i https://api.aixigo.com/apidocs/apidocs/swagger.json -l java -o tmp
cd tmp
mvn clean package
There are several options to fix this. On is specifying <failOnError>false</failOnError> in the generated pom, the other ones are generating correct JavaDoc.
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
Reproduce the failure with the supplied swagger.json using the shown swagger-codegen command, then run mvn clean package in the generated tmp project. Inspect ProcessAutomationApi.java and RebalancingApi.java in the generated output and the Java generation templates that produce their comments; done means the generated client completes the JavaDoc phase without invalid references, links, or entities.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100