Commit 5dd8d18
authored
Use self for member access/assignment in all initializers, decoders, and encoders (#700)
### Motivation
In order to address #695 we made some targeted fixes (#696, #699) to use
explicit-self to avoid clashing with schema property names. This
addressed a clash with a specific variable with properties of only
certain schemas, but there are more places where we might encounter
future issues. Specifically, we have other variable names which might
cause a clash (e.g. `storage` and `discriminator`), and there are other
flavours of initializers, encoders, and decoders that were not updated
in the targeted fix.
In this PR, we update all access and assignment in the generated code
dealing with schemas to use explicit-self.
### Modifications
- Use self for member access and assignment in all initializers,
decoders, and encoders.
- Update the reference tests and snippet tests.
### Result
Removed some cases where valid OpenAPI docs would produce non-compiling
code.
### Test Plan
Snippet and reference tests. The latter is actually compiled during the
CI.1 parent 2e1b6fc commit 5dd8d18
File tree
5 files changed
+170
-167
lines changed- Sources/_OpenAPIGeneratorCore
- Layers
- Translator
- CommonTranslations
- TypesTranslator
- Tests/OpenAPIGeneratorReferenceTests
- Resources/ReferenceSources/Petstore
5 files changed
+170
-167
lines changedLines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1354 | 1354 | | |
1355 | 1355 | | |
1356 | 1356 | | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
1357 | 1367 | | |
1358 | 1368 | | |
1359 | 1369 | | |
| |||
1555 | 1565 | | |
1556 | 1566 | | |
1557 | 1567 | | |
| 1568 | + | |
1558 | 1569 | | |
1559 | 1570 | | |
1560 | 1571 | | |
| |||
Lines changed: 9 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
| 184 | + | |
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
202 | | - | |
| 201 | + | |
203 | 202 | | |
204 | 203 | | |
205 | 204 | | |
| |||
216 | 215 | | |
217 | 216 | | |
218 | 217 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
| 218 | + | |
223 | 219 | | |
224 | 220 | | |
225 | 221 | | |
226 | 222 | | |
227 | 223 | | |
228 | 224 | | |
229 | 225 | | |
230 | | - | |
| 226 | + | |
231 | 227 | | |
232 | 228 | | |
233 | 229 | | |
| |||
250 | 246 | | |
251 | 247 | | |
252 | 248 | | |
253 | | - | |
254 | | - | |
255 | | - | |
| 249 | + | |
256 | 250 | | |
257 | 251 | | |
258 | 252 | | |
259 | 253 | | |
260 | | - | |
| 254 | + | |
261 | 255 | | |
262 | 256 | | |
263 | 257 | | |
| |||
Lines changed: 5 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 110 | + | |
| 111 | + | |
114 | 112 | | |
115 | 113 | | |
116 | 114 | | |
| |||
127 | 125 | | |
128 | 126 | | |
129 | 127 | | |
130 | | - | |
| 128 | + | |
131 | 129 | | |
132 | 130 | | |
133 | 131 | | |
| |||
167 | 165 | | |
168 | 166 | | |
169 | 167 | | |
170 | | - | |
| 168 | + | |
171 | 169 | | |
172 | 170 | | |
173 | 171 | | |
| |||
185 | 183 | | |
186 | 184 | | |
187 | 185 | | |
188 | | - | |
| 186 | + | |
189 | 187 | | |
190 | 188 | | |
191 | 189 | | |
| |||
0 commit comments