Repository navigation
Commit a268fb0
committed
[java][okhttp] Fix defects found in review of the new library
Correctness fixes to the forked templates:
- GzipRequestInterceptor: restore the forceContentLength() wrapper dropped from
okhttp-gson. Without it the gzip body reports contentLength() == -1, OkHttp
falls back to Transfer-Encoding: chunked, and every compressed request fails
against servers that reject chunked request bodies. The unused okio.Buffer
import was the tell that the removal was accidental.
- ProgressResponseBody: restore the memoized bufferedSource field. OkHttp calls
source() again on close(), so without caching each call built a fresh
ForwardingSource over a partially consumed stream, resetting the progress
counter and risking double reads.
- ProgressRequestBody: CountingSink no longer reports done, so a known-length
body gets exactly one terminal callback instead of two (writeTo still emits
the terminal event, which is what unknown-length bodies rely on). Dropped the
unreachable private countingSink(Sink) helper.
- AWS4Auth: sign x-amz-* headers. They were never added to the signable
request, so SigV4 omitted them from SignedHeaders and AWS rejected the
signature. Content-Type is deliberately left unsigned because OkHttp's
BridgeInterceptor appends the multipart boundary after signing. This also
wires up the two-pass auth ordering in ApiClient, which until now had no
effect.
- JSON: register RFC3339JavaTimeModule for Jackson 2. The codegen already
emitted RFC3339InstantDeserializer and RFC3339JavaTimeModule, but nothing
installed them, so the space-separated RFC3339 normalization never ran. Every
other Jackson library registers it. Jackson 3 does not emit the classes and
is left untouched.
- additional_properties: replace Java `transient` with @JsonbTransient. The
transient keyword was added by this fork and made Java serialization drop all
undeclared properties when serializableModel=true; @JsonbTransient keeps
JSON-B from emitting the backing map without that side effect.
- ApiResponse: lowercase header keys in the caseInsensitiveResponseHeaders
branch, matching okhttp-gson, native, jersey2 and jersey3.
- pojo: stop emitting five Jackson imports that JavaClientCodegen already
contributes via model.imports, which produced duplicate import lines.
JsonTypeName is only contributed for Jackson 2, so it is still emitted from
the template under useJackson3.
Build files:
- build.gradle: add the com.google.android:android compileOnly dependency under
parcelableModel, mirroring the pom. Generated Parcelable models now compile
with a plain Gradle build.
- build.sbt: add the swagger-parser-v3 dependency under dynamicOperations and
the jakarta.validation-api dependency under useBeanValidation, both of which
the pom and Gradle builds already declared; gate jackson-annotations on
Jackson 2 so Jackson 3 clients take the version aligned by jackson-databind.
All 27 samples regenerated; each compiles and passes mvn test, and
JavaClientCodegenTest still passes 288 tests. okhttp-gson output is unchanged.1 parent b7334df commit a268fb0
504 files changed
Lines changed: 1437 additions & 1199 deletions
File tree
- modules/openapi-generator/src/main/resources/Java/libraries/okhttp
- auth
- samples/client
- echo_api/java
- okhttp-jackson-user-defined-templates
- modelCopy
- src/main/java/org/openapitools/client
- model
- okhttp-user-defined-templates/src/main/java/org/openapitools/client
- okhttp/src/main/java/org/openapitools/client
- others/java
- okhttp-jackson-oneOf/src/main/java/org/openapitools/client
- okhttp-jackson3-oneOf
- src/main/java/org/openapitools/client
- okhttp-jsonb-oneOf/src/main/java/org/openapitools/client
- okhttp-oneOf-array
- src/main/java/org/openapitools/client
- okhttp-oneOf/src/main/java/org/openapitools/client
- okhttp-streaming/src/main/java/org/openapitools/client
- petstore/java
- okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client
- okhttp-3.1/src/main/java/org/openapitools/client
- model
- okhttp-awsv4signature/src/main/java/org/openapitools/client
- auth
- model
- okhttp-dynamicOperations
- src/main/java/org/openapitools/client
- model
- okhttp-group-parameter/src/main/java/org/openapitools/client
- model
- okhttp-jackson-jspecify/src/main/java/org/openapitools/client
- model
- okhttp-jackson-nullable-required/src/main/java/org/openapitools/client
- model
- okhttp-jackson3-jspecify
- src/main/java/org/openapitools/client
- model
- okhttp-jackson3
- src/main/java/org/openapitools/client
- model
- okhttp-jackson/src/main/java/org/openapitools/client
- model
- okhttp-jsonb-jspecify/src/main/java/org/openapitools/client
- model
- okhttp-jsonb-nullable-required/src/main/java/org/openapitools/client
- model
- okhttp-jsonb/src/main/java/org/openapitools/client
- model
- okhttp-nullable-required/src/main/java/org/openapitools/client
- model
- okhttp-parcelableModel
- src/main/java/org/openapitools/client
- model
- okhttp-swagger1/src/main/java/org/openapitools/client
- model
- okhttp-swagger2/src/main/java/org/openapitools/client
- model
- okhttp/src/main/java/org/openapitools/client
- model
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
34 | 60 | | |
35 | 61 | | |
36 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| 194 | + | |
194 | 195 | | |
195 | 196 | | |
196 | 197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | 50 | | |
55 | 51 | | |
56 | 52 | | |
| |||
68 | 64 | | |
69 | 65 | | |
70 | 66 | | |
71 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
72 | 70 | | |
73 | 71 | | |
74 | 72 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
38 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
39 | 45 | | |
40 | 46 | | |
41 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
66 | 76 | | |
67 | 77 | | |
68 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
117 | 121 | | |
118 | 122 | | |
119 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
59 | 67 | | |
60 | 68 | | |
61 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
| |||
0 commit comments