7

I need to create swagger codegen client for java, javascript pointing to swagger yaml pusblished on https.

When tried below command got SSLHandshakeError.

"swagger-codegen generate -i https://localhost:443/api/swagger.yaml -l java -o java-api/."

Also when swagger codegen generates client will it have SSL Mutual TLS code for https swagger spec url?

Please help.

DanielBarbarian
  • 5,093
  • 12
  • 35
  • 44
erdarun
  • 441
  • 1
  • 8
  • 14

2 Answers2

13

Please add -D io.swagger.parser.util.RemoteUrl.trustAll=true when generating the code.

Ref: https://github.com/swagger-api/swagger-codegen/wiki/FAQ#is-there-a-way-to-disable-certificate-verification

UPDATE: On May 2018, about 50 top contributors and template creators of Swagger Codegen decided to fork Swagger Codegen to maintain a community-driven version called OpenAPI Generator. Please refer to the Q&A for more information.

Mathieu VIALES
  • 4,526
  • 3
  • 31
  • 48
William Cheng
  • 10,137
  • 5
  • 54
  • 79
0

the above answer didn't work for me. if you are facing the same problem as I just use the bellow structure

( "swagger:generate": "SET JAVA_OPTS=-Dio.swagger.parser.util.RemoteUrl.trustAll=true -Dio.swagger.v3.parser.util.RemoteUrl.trustAll=true && openapi-generator generate -i https://xxxxxx/swagger/1.0/swagger.json -g typescript-angular -o ./src/code-gen" )
that's how I solved it

khalil
  • 1
  • 2