mirror of
https://github.com/matrix-org/matrix-spec
synced 2026-03-15 07:54:10 +01:00
Don't put a space when appending the "Must be" strings to the desciption if there isn't a description, otherwise it will mess up the indent
This commit is contained in:
parent
ebc0237109
commit
8322151661
|
|
@ -164,12 +164,16 @@ def get_json_schema_object_fields(obj, enforce_title=False, include_parents=Fals
|
||||||
if props[key_name].get("enum"):
|
if props[key_name].get("enum"):
|
||||||
if len(props[key_name].get("enum")) > 1:
|
if len(props[key_name].get("enum")) > 1:
|
||||||
value_type = "enum"
|
value_type = "enum"
|
||||||
|
if desc:
|
||||||
|
desc += " "
|
||||||
desc += (
|
desc += (
|
||||||
" One of: %s" % json.dumps(props[key_name]["enum"])
|
"One of: %s" % json.dumps(props[key_name]["enum"])
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
if desc:
|
||||||
|
desc += " "
|
||||||
desc += (
|
desc += (
|
||||||
" Must be '%s'." % props[key_name]["enum"][0]
|
"Must be '%s'." % props[key_name]["enum"][0]
|
||||||
)
|
)
|
||||||
if isinstance(value_type, list):
|
if isinstance(value_type, list):
|
||||||
value_type = " or ".join(value_type)
|
value_type = " or ".join(value_type)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue