Closed
Description
Describe the bug
With a route definition that sets the content type to application/json
but the schema type to a string, the code generated references an invalid variable.
To Reproduce
- Add a route definition like so:
"/chat/web": {
"parameters": [],
"post": {
"security": [
{
"basicAuth": []
}
],
"description": "Send a message to the chat",
"responses": {
"204": {
"description": "Message sent"
}
},
"requestBody": {
"description": "The text to send",
"required": true,
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
- Run
openapi-python-client update ...
- Open the python file at api/.../post_chat_web.py
- See
_get_kwargs
code
def _get_kwargs(
*,
client: AuthenticatedClient,
json_body: str,
) -> Dict[str, Any]:
url = "{}/chat/web".format(client.base_url)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"json": json_json_body,
}
Expected behavior
The code in post_chat_web.py
should reference json_body
and not json_json_body
.
OpenAPI Spec File
https://raw.githubusercontent.com/Nadybot/Nadybot/unstable/html/api.json
Desktop (please complete the following information):
- OS: Fedora 34
- Python Version: 3.9.6
- openapi-python-client version 0.10.3