I'm using openapi-generator to create a C# class for accessing a REST API. This REST API is http and does not have a SSL certificate.
The generated C# class was done by this command
java -jar ./openapi-generator-cli.jar generate
-g csharp
-i ../../openapi.yaml
-o cn_http_client_csharp
--additional-properties=artifactId=http-client
--additional-properties=io.swagger.parser.util.RemoteUrl.trustAll=true
--additional-properties=io.swagger.v3.parser.util.RemoteUrl.trustAll=true
--skip-validate-spec
When testing this class with another C# application, I always get the following exception "The SSL connection could not be established, see inner exception."
I tried to use some tipps from openapi-generator wiki, but I can't fix this issue
I found solution.
net6.0
#!/bin/bash
export JAVA_OPTS="-Dio.swagger.parser.util.RemoteUrl.trustAll=true -Dio.swagger.v3.parser.util.RemoteUrl.trustAll=true"
java -jar /home/user/Projects/OpenApiGenerator/openapi-generator-cli-7.0.1.jar generate -g csharp -i /home/user/Projects/swagger.json -o /home/user/Projects/SwaggerCodeGen --additional-properties=useDateTimeOffset=true,targetFramework=net6.0
.dll's
in my projectvar apiInstance = new AuthApi(new Configuration {
BasePath = _gatewayBasePath,
RemoteCertificateValidationCallback = (_, _, _, _) => { return true;}
});