swagger-api/swagger-codegen

swagger-codegen Java client throws PROTOCOL_ERROR when running on Android

Open

#8526 opened on Aug 3, 2018

View on GitHub
 (3 comments) (0 reactions) (0 assignees)HTML (12,701 stars) (5,474 forks)batch import
help wanted

Description

Description

When running Java client on Android, it throws PROTOCOL_ERROR - I think it has something to do with Java client using an old version of OkHttp that has HTTP2.0 bugs

Swagger-codegen version

2.3.1

Swagger declaration file content or url

https://api.cloudmersive.com/convert/docs/v1/swagger

Command line used for generation

java -jar swagger-codegen-cli.jar generate -i https://api.cloudmersive.com/convert/docs/v1/swagger -l java --api-package com.cloudmersive.client --model-package com.cloudmersive.client.model --invoker-package com.cloudmersive.client.invoker --group-id com.cloudmersive --artifact-id cloudmersive-java-api-client --artifact-version 1.1.9 -o .

Steps to reproduce

Generate the client using above command

Create a test project in Android Studio

Immediately see the protocol_error:

com.cloudmersive.client.invoker.ApiException: java.io.IOException: stream was reset: PROTOCOL_ERROR

We also tried generating the client with the other library templates but those don't actually compile - pretty frustrating.

Related issues/PRs

https://github.com/square/okhttp/issues/1844

Suggest a fix/enhancement

Change the Java client to use OK HTTP 3.11.0 instead of old 2.75.0 version

Contributor guide