api_docs: Add check for extra `additionalProperties` in return vals.

Adds a check for `additionalProperties: true` when there are no
properties listed in the schema.

This currently only happens in one place, but will be helpful for
deduplicating text between the `register-queue` and `get-events`
endpoints.
This commit is contained in:
Lauryn Menard 2022-02-02 17:45:19 +01:00 committed by Tim Abbott
parent d55c137277
commit cc712dbade
1 changed files with 9 additions and 0 deletions

View File

@ -157,6 +157,15 @@ class APIReturnValuesTablePreprocessor(Preprocessor):
return_values[return_value]["additionalProperties"]["properties"], return_values[return_value]["additionalProperties"]["properties"],
spacing + 8, spacing + 8,
) )
elif return_values[return_value]["additionalProperties"].get(
"additionalProperties", False
):
ans += self.render_table(
return_values[return_value]["additionalProperties"]["additionalProperties"][
"properties"
],
spacing + 8,
)
if ( if (
"items" in return_values[return_value] "items" in return_values[return_value]
and "properties" in return_values[return_value]["items"] and "properties" in return_values[return_value]["items"]