diff --git a/templating/matrix_templates/units.py b/templating/matrix_templates/units.py index 84c96ce3..975f7c80 100644 --- a/templating/matrix_templates/units.py +++ b/templating/matrix_templates/units.py @@ -247,7 +247,8 @@ class MatrixUnits(Units): "rows": [{ "key": good_response["schema"].get("name", ""), "type": res_type, - "desc": res.get("description", "") + "desc": res.get("description", ""), + "req_str": "" }] }) elif res_type and Units.prop(good_response, "schema/properties"): @@ -257,6 +258,24 @@ class MatrixUnits(Units): for table in res_tables: if "no-table" not in table: endpoint["res_tables"].append(table) + elif res_type and Units.prop(good_response, "schema/items"): + # response is an array: + # FIXME: Doesn't recurse at all. + schema = good_response["schema"] + array_type = Units.prop(schema, "items/type") + if Units.prop(schema, "items/allOf"): + array_type = ( + Units.prop(schema, "items/title") + ) + endpoint["res_tables"].append({ + "title": schema.get("title", ""), + "rows": [{ + "key": "N/A", + "type": ("[%s]" % array_type), + "desc": schema.get("description", ""), + "req_str": "" + }] + }) endpoints.append(endpoint)