openapi: Get parameters from requestBody too.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2024-01-31 21:07:29 -08:00
committed by Anders Kaseorg
parent a67d1b57b9
commit 5cac872e4b
3 changed files with 32 additions and 7 deletions

View File

@@ -336,10 +336,10 @@ def generate_curl_example(
)
lines.append(example_value)
if "requestBody" in operation_entry:
properties = operation_entry["requestBody"]["content"]["multipart/form-data"]["schema"][
"properties"
]
if "requestBody" in operation_entry and "multipart/form-data" in (
content := operation_entry["requestBody"]["content"]
):
properties = content["multipart/form-data"]["schema"]["properties"]
for key, property in properties.items():
lines.append(" -F " + shlex.quote("{}=@{}".format(key, property["example"])))