swagger-api/swagger-codegen

swagger-codegen Java client throws PROTOCOL_ERROR when running on Android

Open

#8526 aperta il 3 ago 2018

Vedi su GitHub
 (3 commenti) (0 reazioni) (0 assegnatari)HTML (5474 fork)batch import
help wanted

Metriche repository

Star
 (12.701 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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

Guida contributor