Fix examples for new schema

Fix missed example in make_join

Fix state array in response of send_join

Try removing examples from send_join?

Try printing more information about the error

Copy/paste known working examples

Try schema definitions in the response?
pull/977/head
Travis Ralston 6 years ago
parent 5d8fa65e6e
commit 890fb1a019

@ -75,6 +75,12 @@ def check_response(filepath, request, code, response):
filepath, request, code filepath, request, code
)) ))
check_schema(filepath, example, schema) check_schema(filepath, example, schema)
except jsonschema.SchemaError as error:
for suberror in sorted(error.context, key=lambda e: e.schema_path):
print(list(suberror.schema_path), suberror.message, sep=", ")
raise ValueError("Error validating JSON schema for %r %r" % (
request, code
), e)
except Exception as e: except Exception as e:
raise ValueError("Error validating JSON schema for %r %r" % ( raise ValueError("Error validating JSON schema for %r %r" % (
request, code request, code

@ -115,6 +115,9 @@ paths:
"$ref": "examples/minimal_pdu.json", "$ref": "examples/minimal_pdu.json",
"type": "m.room.member", "type": "m.room.member",
"state_key": "@joe:elsewhere.com", "state_key": "@joe:elsewhere.com",
"origin": "example.org",
"origin_server_ts": 1549041175876,
"sender": "@someone:example.org",
"unsigned": { "unsigned": {
"invite_room_state": [ "invite_room_state": [
{ {
@ -173,6 +176,9 @@ paths:
"$ref": "examples/minimal_pdu.json", "$ref": "examples/minimal_pdu.json",
"type": "m.room.member", "type": "m.room.member",
"state_key": "@someone:example.org", "state_key": "@someone:example.org",
"origin": "example.org",
"origin_server_ts": 1549041175876,
"sender": "@someone:example.org",
"unsigned": { "unsigned": {
"invite_room_state": [ "invite_room_state": [
{ {

@ -119,6 +119,9 @@ paths:
"$ref": "examples/minimal_pdu.json", "$ref": "examples/minimal_pdu.json",
"type": "m.room.member", "type": "m.room.member",
"state_key": "@joe:elsewhere.com", "state_key": "@joe:elsewhere.com",
"origin": "example.org",
"origin_server_ts": 1549041175876,
"sender": "@someone:example.org",
"content": { "content": {
"membership": "invite" "membership": "invite"
}, },
@ -167,6 +170,9 @@ paths:
"$ref": "examples/minimal_pdu.json", "$ref": "examples/minimal_pdu.json",
"type": "m.room.member", "type": "m.room.member",
"state_key": "@someone:example.org", "state_key": "@someone:example.org",
"origin": "example.org",
"origin_server_ts": 1549041175876,
"sender": "@someone:example.org",
"unsigned": { "unsigned": {
"invite_room_state": [ "invite_room_state": [
{ {

@ -127,6 +127,9 @@ paths:
"$ref": "examples/minimal_pdu.json", "$ref": "examples/minimal_pdu.json",
"type": "m.room.member", "type": "m.room.member",
"state_key": "@someone:example.org", "state_key": "@someone:example.org",
"origin": "example.org",
"origin_server_ts": 1549041175876,
"sender": "@someone:example.org",
"content": { "content": {
"membership": "join" "membership": "join"
} }
@ -228,12 +231,14 @@ paths:
- origin - origin
- origin_server_ts - origin_server_ts
- type - type
- state_key
- content - content
example: { example: {
"$ref": "examples/minimal_pdu.json", "$ref": "examples/minimal_pdu.json",
"type": "m.room.member", "type": "m.room.member",
"state_key": "@someone:example.org", "state_key": "@someone:example.org",
"origin": "example.org",
"origin_server_ts": 1549041175876,
"sender": "@someone:example.org",
"content": { "content": {
"membership": "join" "membership": "join"
} }
@ -267,19 +272,29 @@ paths:
type: object type: object
title: PDU title: PDU
description: |- description: |-
The `PDUs <#pdus>`_ contained in the auth chain. The event format The `PDUs <#pdus>`_ that make up the auth chain. The event format varies depending
varies depending on the room version - check the `room version specification`_ on the room version - check the `room version specification`_ for precise event formats.
for precise event formats. schema:
type: object
properties: [] properties: []
example: example:
$ref: "examples/minimal_pdu.json" $ref: "examples/minimal_pdu.json"
state: state:
type: array type: array
description: The room state. description: |-
The room state. The event format varies depending on the room version -
check the `room version specification`_ for precise event formats.
items: items:
type: object type: object
title: PDU
description: |-
The `PDUs <#pdus>`_ for the fully resolved state of the room. The event format varies depending
on the room version - check the `room version specification`_ for precise event formats.
schema: schema:
$ref: "definitions/pdu.yaml" type: object
properties: []
example:
$ref: "examples/minimal_pdu.json"
required: ["auth_chain", "state", "origin"] required: ["auth_chain", "state", "origin"]
examples: examples:
application/json: [ application/json: [

@ -120,6 +120,9 @@ paths:
"$ref": "examples/minimal_pdu.json", "$ref": "examples/minimal_pdu.json",
"type": "m.room.member", "type": "m.room.member",
"state_key": "@someone:example.org", "state_key": "@someone:example.org",
"origin": "example.org",
"origin_server_ts": 1549041175876,
"sender": "@someone:example.org",
"content": { "content": {
"membership": "leave" "membership": "leave"
} }
@ -216,6 +219,9 @@ paths:
"$ref": "examples/minimal_pdu.json", "$ref": "examples/minimal_pdu.json",
"type": "m.room.member", "type": "m.room.member",
"state_key": "@someone:example.org", "state_key": "@someone:example.org",
"origin": "example.org",
"origin_server_ts": 1549041175876,
"sender": "@someone:example.org",
"content": { "content": {
"membership": "leave" "membership": "leave"
} }

Loading…
Cancel
Save