swagger-api/swagger-codegen

swagger-codegen Java client throws PROTOCOL_ERROR when running on Android

Open

#8,526 建立於 2018年8月3日

在 GitHub 查看
 (3 留言) (0 反應) (0 負責人)HTML (12,701 star) (5,474 fork)batch import
help wanted

描述

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

貢獻者指南