Skip to content

Commit 363567c

Browse files
authored
fix(python): Fix wire tests param names (#10854)
fix param names
1 parent 74a0050 commit 363567c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

generators/python-v2/sdk/src/wire-tests/WireTestGenerator.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,18 @@ export class WireTestGenerator {
328328
if (example.queryParameters) {
329329
for (const [key, value] of Object.entries(example.queryParameters)) {
330330
if (value != null) {
331-
queryParams.push([key, this.formatValue(value)]);
331+
const queryParameterDeclaration = endpoint.queryParameters.find(
332+
(queryParameter) => queryParameter.name.wireValue === key
333+
);
334+
if (queryParameterDeclaration != null) {
335+
// Use the safe name to avoid collisions with reserved keywords
336+
queryParams.push([
337+
queryParameterDeclaration.name.name.snakeCase.safeName,
338+
this.formatValue(value)
339+
]);
340+
} else {
341+
queryParams.push([key, this.formatValue(value)]);
342+
}
332343
}
333344
}
334345
}

0 commit comments

Comments
 (0)