Commit 8f8fe96
authored
* Fix testing plugin to generate correct package-qualified result types
This fixes issue #206 where the testing plugin was generating invalid Go
syntax for method return types. The problem occurred when the result type
was an array or slice - the template was incorrectly placing the pointer
operator before the package qualifier and array brackets.
For example, a method returning []*AccessControl would generate:
func GetAccessControl(...) (*bff.[]*AccessControl, error)
This is syntactically invalid. The correct syntax should be:
func GetAccessControl(...) ([]*bff.AccessControl, error)
The fix:
- Added PkgResultRef field to clientMethodData to store the properly
package-qualified result type reference
- Use Goa's GoFullTypeRef method to generate the package-qualified type
reference, which correctly handles arrays, maps, primitives, and user
types
- Updated the client_methods template to use PkgResultRef instead of
manually constructing the type reference
This leverages Goa's existing codegen infrastructure which properly
handles all type cases including:
- Pointer types: *Result -> *pkg.Result
- Array/slice types: []*Result -> []*pkg.Result
- Map types: map[K]*Result -> map[K]*pkg.Result
- Nested types: []map[K]*Result -> []map[K]*pkg.Result
Fixes #206
* mains: append http.FileSystem args for Files() DSL; detect HasHTTP for file servers (fixes #223)
1 parent 272743b commit 8f8fe96
File tree
4 files changed
+99
-7
lines changed- mains
- templates
- testdata
4 files changed
+99
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| |||
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
| |||
110 | 115 | | |
111 | 116 | | |
112 | 117 | | |
113 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
114 | 128 | | |
115 | 129 | | |
116 | 130 | | |
117 | 131 | | |
118 | 132 | | |
119 | 133 | | |
| 134 | + | |
| 135 | + | |
120 | 136 | | |
121 | | - | |
| 137 | + | |
122 | 138 | | |
123 | 139 | | |
124 | 140 | | |
| |||
228 | 244 | | |
229 | 245 | | |
230 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
231 | 253 | | |
232 | 254 | | |
233 | 255 | | |
| |||
241 | 263 | | |
242 | 264 | | |
243 | 265 | | |
| 266 | + | |
244 | 267 | | |
245 | 268 | | |
246 | 269 | | |
| |||
354 | 377 | | |
355 | 378 | | |
356 | 379 | | |
357 | | - | |
| 380 | + | |
358 | 381 | | |
359 | 382 | | |
360 | 383 | | |
| |||
378 | 401 | | |
379 | 402 | | |
380 | 403 | | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
8 | | - | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
| 122 | + | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
| 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 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
0 commit comments