openapi: Correctly encode object and array parameters.

The current description of object and array parameters in
zulip.yaml is wrong and renders incorrect requests on using OpenAPI
tools such as SwaggerIO, etc. Fix it by encoding it correctly and
changing tests accordingly.

Fixes #14380.
This commit is contained in:
orientor
2020-06-27 22:53:50 +05:30
committed by Tim Abbott
parent 9392e8bec7
commit 166314de78
4 changed files with 212 additions and 136 deletions

View File

@@ -46,7 +46,10 @@ def patch_openapi_example_values(entry: str, params: List[Dict[str, Any]],
for param in params:
param_name = param["name"]
if param_name in realm_example_values:
param["example"] = realm_example_values[param_name]
if 'content' in param:
param['content']['application/json']['example'] = realm_example_values[param_name]
else:
param["example"] = realm_example_values[param_name]
if request_body is not None:
properties = request_body["content"]["multipart/form-data"]["schema"]["properties"]