Skip to content

Commit c8a6e48

Browse files
Handle body properties with dashes in Python exporter
1 parent 86ae359 commit c8a6e48

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/exporters/python.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export class PythonExporter implements FormatExporter {
121121
}
122122
}
123123
}
124-
return name;
124+
return name.replaceAll("-", "_");
125125
});
126126

127127
// custom conditional to check for request body kind

tests/convert.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,22 @@ resp1 = client.search(
222222
},
223223
)
224224
225+
`,
226+
);
227+
});
228+
229+
it("converts attribute with dashes to python", async () => {
230+
expect(
231+
await convertRequests(
232+
`PUT /_security/settings {"security-profile": {}}`,
233+
"python",
234+
{},
235+
),
236+
).toEqual(
237+
`resp = client.security.update_settings(
238+
security_profile={},
239+
)
240+
225241
`,
226242
);
227243
});

0 commit comments

Comments
 (0)