Convert things that mention "Transaction" to swagger

There's two kinds of transactions currently: one with EDUs and one without. The one with EDUs is only used on /send, however the schema is still somewhat worth splitting out for simplicity.

The examples are brought apart to make them slightly more reusable for when they get dumped into the relevant sections of the spec (see TODO in server_server_api.rst)

Further, the Transactions stuff introduces tuples to the spec. The units.py has been updated to support this.
This commit is contained in:
Travis Ralston 2018-07-11 16:51:24 -06:00
parent 808a82e811
commit 374ec00046
12 changed files with 485 additions and 54 deletions

View file

@ -292,10 +292,19 @@ def process_data_type(prop, required=False, enforce_title=True):
is_object = True
elif prop_type == "array":
nested = process_data_type(prop["items"])
prop_title = "[%s]" % nested["title"]
tables = nested["tables"]
enum_desc = nested["enum_desc"]
items = prop["items"]
if isinstance(items, list):
prop_title = "["
for i in items:
nested = process_data_type(i)
tables.extend(nested['tables'])
prop_title = "%s%s, " % (prop_title, nested['title'])
prop_title = prop_title[:-2] + "]"
else:
nested = process_data_type(prop["items"])
prop_title = "[%s]" % nested["title"]
tables = nested["tables"]
enum_desc = nested["enum_desc"]
else:
prop_title = prop_type
@ -505,7 +514,13 @@ class MatrixUnits(Units):
if val_type == "array":
items = param.get("items")
if items:
val_type = "[%s]" % items.get("type")
if isinstance(items, list):
val_type = "["
for i in items:
val_type += "%s, " % items.get("type")
val_type = val_type[:-2] + "]"
else:
val_type = "[%s]" % items.get("type")
if param.get("enum"):
val_type = "enum"