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

Fix schema of m.mentions object #1635

Merged
merged 4 commits into from Sep 19, 2023
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
1 change: 1 addition & 0 deletions changelogs/internal/newsfragments/1635.clarification
@@ -0,0 +1 @@
Fix schema of `m.mentions` object.
14 changes: 14 additions & 0 deletions content/client-server-api/modules/mentions.md
Expand Up @@ -13,6 +13,20 @@ the event to reference the entity being mentioned.

{{% definition path="api/client-server/definitions/m.mentions" %}}

An event's content will then look like this:

```json
{
"body": "Hello Alice!",
"msgtype": "m.text",
"format": "org.matrix.custom.html",
"formatted_body": "Hello <a href='https://matrix.to/#/@alice:example.org'>Alice</a>!",
"m.mentions": {
"user_ids": ["@alice:example.org"]
}
}
```

Additionally, see the [`.m.rule.is_user_mention`](#_m_rule_is_user_mention) and
[`.m.rule.is_room_mention`](#_m_rule_is_room_mention) push rules.
Users should not add their own Matrix ID to the `m.mentions` property as outgoing
Expand Down
12 changes: 4 additions & 8 deletions data/api/client-server/definitions/m.mentions.yaml
Expand Up @@ -18,17 +18,13 @@ description: |-
Describes whether the event mentions other users or the room. This is contained
within the event's `content` alongside other fields for the relevant event type.
example: {
Copy link
Contributor

Choose a reason for hiding this comment

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

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 see. I guess that example should be included directly in the spec rather than in the JSON schema, then?

The reason I stumbled upon this is that I'd like to add a tool that validates all JSON schemas in CI. This one would not pass as the example doesn't match the schema.

Copy link
Contributor

Choose a reason for hiding this comment

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

That might be better, yeah.

"body": "Hello Alice!",
"msgtype": "m.text",
"format": "org.matrix.custom.html",
"formatted_body": "Hello <a href='https://matrix.to/#/@alice:example.org'>Alice</a>!",
"m.mentions": {
"user_ids": ["@alice:example.org"]
}
"user_ids": ["@alice:example.org"]
}
properties:
user_ids:
type: string[]
type: array
items:
type: string
description: A list of Matrix IDs of mentioned users.
room:
type: boolean
Expand Down