Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define a 400 response from {PUT,GET,DELETE} /directory/rooms/{roomAlias} #1286

Merged
merged 4 commits into from Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1 @@
Define a 400 response from `/_matrix/client/v3/directory/rooms/{roomAlias}`.
39 changes: 36 additions & 3 deletions data/api/client-server/directory.yaml
Expand Up @@ -37,7 +37,9 @@ paths:
- in: path
type: string
name: roomAlias
description: The room alias to set.
description: |
The room alias to set. Its format is defined
[in the appendices](/appendices/#room-aliases).
required: true
x-example: "#monkeys:matrix.org"
- in: body
Expand All @@ -61,6 +63,15 @@ paths:
application/json: {}
schema:
type: object
400:
description: The given `roomAlias` is not a valid room alias.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Define valid". We can probably copy a lot of the text from #1261 and use it here.

Generally though, I'm more in favour of fixing the spec to say that 400 M_INVALID_PARAM is something which can appear on every endpoint rather than each endpoint individually. This is likely a larger effort than this PR should take on, however.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would ideally link to https://spec.matrix.org/latest/appendices/#room-aliases here, but I couldn't find an example of such a hyperlink from the OpenAPI spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is

(see also: https://spec.matrix.org/v1.2/appendices/#signing-json)
but this a) is hardcoded to a spec version and b) doesn't appear in the spec (#1287)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, directly above this:

by the [key algorithm](/client-server-api/#key-algorithms).

That'll do.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is

(see also: https://spec.matrix.org/v1.2/appendices/#signing-json)

but this a) is hardcoded to a spec version and b) doesn't appear in the spec (#1287)

This looks like a bug, ftr. Will take a look.

examples:
application/json: {
"errcode": "M_INVALID_PARAM",
"error": "Room alias invalid"
}
schema:
"$ref": "definitions/errors/error.yaml"
409:
description: A room alias with that name already exists.
examples:
Expand All @@ -86,7 +97,9 @@ paths:
- in: path
type: string
name: roomAlias
description: The room alias.
description: |
The room alias. Its format is defined
[in the appendices](/appendices/#room-aliases).
required: true
x-example: "#monkeys:matrix.org"
responses:
Expand All @@ -113,6 +126,15 @@ paths:
"another.com"
]
}
400:
description: The given `roomAlias` is not a valid room alias.
examples:
application/json: {
"errcode": "M_INVALID_PARAM",
"error": "Room alias invalid"
}
schema:
"$ref": "definitions/errors/error.yaml"
404:
description: There is no mapped room ID for this room alias.
examples:
Expand Down Expand Up @@ -146,7 +168,9 @@ paths:
- in: path
type: string
name: roomAlias
description: The room alias to remove.
description: |
The room alias to remove. Its format is defined
[in the appendices](/appendices/#room-aliases).
required: true
x-example: "#monkeys:matrix.org"
responses:
Expand Down Expand Up @@ -220,6 +244,15 @@ paths:
items:
type: string
required: ['aliases']
400:
description: The given `roomAlias` is not a valid room alias.
examples:
application/json: {
"errcode": "M_INVALID_PARAM",
"error": "Room alias invalid"
}
schema:
"$ref": "definitions/errors/error.yaml"
403:
description: The user is not permitted to retrieve the list of local aliases for the room.
examples:
Expand Down