swagger-api / swagger-api/swagger-codegen
The "-Dio.swagger.parser.util.RemoteUrl.trustAll=true" parameter for Java suggested in FAQ seems not working properly
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
The "-Dio.swagger.parser.util.RemoteUrl.trustAll=true" parameter for Java suggested in FAQ seems not working properly.
Comparing the java code of two project, one generated with "-Dio.swagger.parser.util.RemoteUrl.trustAll=true" and the other without this parameter, there are no difference between the two sources (only the generation date).
Running one or the other project from Eclipse Photon, give the same error: “: unable to find valid certification path to requested target” against a server with a self signed certificate.
Swagger-codegen version
swagger-codegen-2.3.1
Swagger declaration file content or url
swagger-aws.json referred later, is downloadable from:
https://ec2-34-254-138-179.eu-west-1.compute.amazonaws.com/v2/api-docs?group=thingsboard
Command line used for generation
swagger-codegen-2.3.1$ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i ../swagger-aws.json -Dio.swagger.parser.util.RemoteUrl.trustAll=true -l java -o ./java-code
Steps to reproduce
- “Download ZIP “swagger-codegen-2.3.1” from https://github.com/swagger-api/swagger-codegen
- cd swagger-codegen-2.3.1
- mvn clean install
- java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i ../swagger-aws.json -Dio.swagger.parser.util.RemoteUrl.trustAll=true -l java -o ./java-code
- Import in Eclipse Photon the "java-code" project with “Import-Project from folder”
- Create a new class “AdminControllerApiExample” in “io.swagger.client” containing the java code specified in readme.md “Getting Started” and modify any reference X-Authorization with XAuthorization
- Running it, I get the error “: unable to find valid certification path to requested target”
Related issues/PRs
https://github.com/swagger-api/swagger-codegen/issues/300
Suggest a fix/enhancement
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 by reproducing the swagger-codegen-2.3.1 command with swagger-aws.json and compare output generated with and without the trustAll parameter. Read the FAQ guidance and the generated Java client's README.md, then trace how the generated client handles the HTTPS request. Done means the documented parameter changes the generated client's behavior so the self-signed certificate request succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100