-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
improve display of event subtypes #1283
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Improve display of event subtypes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{{/* | ||
|
||
Renders an event example. Resolves `$ref`s, serializes as JSON, and ensures | ||
that it can be included in HTML. | ||
|
||
This partial is called with the example event object as its context. | ||
|
||
*/}} | ||
|
||
{{ $example_content := partial "json-schema/resolve-refs" (dict "schema" . "path" "event-schemas/examples") }} | ||
{{ $example_json := jsonify (dict "indent" " ") $example_content }} | ||
{{ $example_json = replace $example_json "\\u003c" "<" }} | ||
{{ $example_json = replace $example_json "\\u003e" ">" | safeHTML }} | ||
|
||
```json | ||
{{ $example_json }} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason not to put this title in the definition itself? jsonschema defines a
title
attribute which seems like it would be ideal (https://json-schema.org/draft/2020-12/json-schema-validation.html#name-title-and-description)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mainly because some event definitions already use the
title
attribute (e.g. https://github.com/matrix-org/matrix-spec/blob/main/data/event-schemas/schema/m.room.power_levels.yaml) and set it to something other than what the current title is in the spec.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example you give looks like it should be the
description
rather than thetitle
.Given we know that none of the titles are rendered, maybe we just rip out the existing ones with no loss of value?
Sorry to make the job (even) bigger, but I feel like this is going to be a maintenance headache we should just solve rather than hack around for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried doing this, and ran into a snag. All the events inherit (using
allOf
, usually indirectly) fromcore-event-schema/event.yaml
, so I need to remove all thetitle
properties from everything in the chain. However, removing the title property fromevent.yaml
turns things likebecomes
The only way I can think of to actually get this to work the way we want it to is to modify all the event yaml files to have a
title
property set to the event type (e.g.title: m.room.message
inm.room.message.yaml
), which seem ... suboptimal.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ugh what a pain in the butt.
It feels like really the problem here is that things like this shouldn't be referring to
event.yaml
anyway, and should use a more specific type (with an appropriate title).(see also my complaints at #897)
... however, maybe fixing that right now is a bit out of scope and we should just stick with your original suggestion.