swagger-api/swagger-codegen

swagger-codegen Java client throws PROTOCOL_ERROR when running on Android

Open

#8.526 geöffnet am 3. Aug. 2018

Auf GitHub ansehen
 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)HTML (5.474 Forks)batch import
help wanted

Repository-Metriken

Stars
 (12.701 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

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