Fix the examples in the swagger API documentation to be valid JSON

This commit is contained in:
Mark Haines 2015-09-18 14:40:48 +01:00
parent 7f81501762
commit 63f08bace6
3 changed files with 6 additions and 4 deletions

View file

@ -101,7 +101,7 @@ paths:
The length of time in milliseconds since an action was performed The length of time in milliseconds since an action was performed
by this user. by this user.
status_msg: status_msg:
type: string type: [string, "null"]
description: The state message for this user if one was set. description: The state message for this user if one was set.
404: 404:
description: |- description: |-
@ -185,7 +185,7 @@ paths:
"last_active_ago": 395, "last_active_ago": 395,
"presence": "offline", "presence": "offline",
"user_id": "@alice:matrix.org" "user_id": "@alice:matrix.org"
} },
"type": "m.presence" "type": "m.presence"
}, },
{ {
@ -195,7 +195,7 @@ paths:
"last_active_ago": 16874, "last_active_ago": 16874,
"presence": "online", "presence": "online",
"user_id": "@marisa:matrix.org" "user_id": "@marisa:matrix.org"
} },
"type": "m.presence" "type": "m.presence"
} }
] ]

View file

@ -343,7 +343,7 @@ paths:
"body": "Hello world!", "body": "Hello world!",
"msgtype": "m.text" "msgtype": "m.text"
}, },
"room_id:" "!wfgy43Sg4a:matrix.org", "room_id:": "!wfgy43Sg4a:matrix.org",
"user_id": "@bob:matrix.org", "user_id": "@bob:matrix.org",
"event_id": "$asfDuShaf7Gafaw:matrix.org", "event_id": "$asfDuShaf7Gafaw:matrix.org",
"type": "m.room.message" "type": "m.room.message"

View file

@ -87,6 +87,8 @@ def get_json_schema_object_fields(obj, enforce_title=False):
desc += ( desc += (
" Must be '%s'." % props[key_name]["enum"][0] " Must be '%s'." % props[key_name]["enum"][0]
) )
if isinstance(value_type, list):
value_type = " or ".join(value_type)
fields["rows"].append({ fields["rows"].append({
"key": key_name, "key": key_name,