api docs: Fix non-rendering response parameter data types.

The current logic doesn't display data types when the additionalProperties
variables are not object, but are array of strings, etc. Changed the if
condition to allow rendering in such cases.
This commit is contained in:
Suyash Vardhan Mathur 2021-02-07 19:34:48 +05:30 committed by Tim Abbott
parent e341a81987
commit 9d74c7001d
1 changed files with 1 additions and 1 deletions

View File

@ -77,7 +77,7 @@ class APIReturnValuesTablePreprocessor(Preprocessor):
# More correctly, we should be doing something that looks at the types;
# print statements and test_api_doc_endpoint is useful for testing.
arr = description.split(": ", 1)
if data_type != "object" or len(arr) == 1 or '\n' in arr[0]:
if len(arr) == 1 or '\n' in arr[0]:
return (spacing * " ") + "* " + description
(key_name, key_description) = arr
return (spacing * " ") + "* " + key_name + ": " + '<span class="api-response-datatype">' + data_type + "</span> " + key_description