Repository navigation
Commit 8932249
[dart] fix: explode object query parameters (#24868)
* fix: [dart] explode object query parameters
A query parameter whose schema is an object and whose style/explode are left at
their defaults — style: form, explode: true — must go on the wire as one
parameter per entry, keyed by the property name alone. The dart client handed
the whole map to _queryParams, which stringified it with Map.toString() into a
single parameter (filter={tld: com, createdDate:gte: 2023-01-01}).
The generated api now iterates an exploded map entry by entry at the call
site; _queryParams is left alone, since it never receives style or explode
and is still the right fallback for every other parameter. A free-form
object is typed Object in dart and needs a cast to Map; a declared map does
not. deepObject and explode: false objects keep their previous wire format,
byte for byte.
The new test fixture covers the four style/explode combinations that decide
the wire format; the test fails without the template change.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CxDNCjqJycKTfzVWg2SeTJ
* fix: [dart] repeat the key per element for a collection in an exploded object
An exploded form-style object query parameter handed each entry to
_queryParams with an empty collection format, which defaults to csv, so a
list value went out comma joined (tld=com%2Cnet) instead of once per element
(tld=com&tld=net). A Set went out as its toString(), since _queryParams only
expands a List, and a null element went out as an empty value.
Each entry is now passed with the 'multi' collection format, and an Iterable
value is turned into a List with its null elements dropped first, so the key
repeats once per non-null element and an empty collection adds nothing. The
closure parameter is typed dynamic so the Iterable check still compiles for a
map with a declared value type.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* chore: [dart] trim the exploded query comment
The shipped comment is one line now, without the implementation note.
Fix the fixture description, which claimed four style/explode
combinations where it covers three, and retitle the test.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test: [dart] keep the shared fixture byte-identical with the other ports
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent 139b1e7 commit 8932249
3 files changed
Lines changed: 46 additions & 1 deletion
File tree
- modules/openapi-generator/src
- main/resources/dart2
- test/java/org/openapitools/codegen/dart
- samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
70 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
71 | 87 | | |
72 | 88 | | |
73 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
140 | 168 | | |
141 | 169 | | |
142 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1382 | 1382 | | |
1383 | 1383 | | |
1384 | 1384 | | |
1385 | | - | |
| 1385 | + | |
| 1386 | + | |
1386 | 1387 | | |
1387 | 1388 | | |
1388 | 1389 | | |
| |||
0 commit comments