-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
Look for examples in all possible locations #2076
Conversation
That way if we fix the rendering in one place, we fix it everywhere. Signed-off-by: Kévin Commaille <[email protected]>
Signed-off-by: Kévin Commaille <[email protected]>
These are common to requests and responses and can be found in the `content` field. This also adds more locations to where we can find examples and makes sure that the order of where we look for them is consistent. Signed-off-by: Kévin Commaille <[email protected]>
They all had a `room_id` field, which doesn't match the definition. Signed-off-by: Kévin Commaille <[email protected]>
Signed-off-by: Kévin Commaille <[email protected]>
Signed-off-by: Kévin Commaille <[email protected]>
yes, the loss of |
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.
lgtm otherwise
Signed-off-by: Kévin Commaille <[email protected]>
…m the fields Signed-off-by: Kévin Commaille <[email protected]>
I removed the global examples of the |
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.
thanks
We used to only look for examples in a few (sometimes arbitrary) places, and we didn't support showing several examples in most cases. This is intended to fix this. In the process we try to deduplicate code to make sure that we use the same logic everywhere.
This can be reviewed commit by commit:
<
and>
inside examples, it's better to keep it in a single place. We also centralize the support for non-JSON examples by using theno-highlight
value.json-schema/resolve-example
partial to return a slice of examples, and to look also at theexamples
key, which is the correct key for examples in JSON Schema.examples
key once again, given that theexample
key is deprecated. And we unify the order of the locations where we look, by using the full examples before we try to generate one from the examples of the fields. This produces only a few changes in the rendered spec (see below).room_id
field although it is not in the corresponding definition.Closes #1157.
Changes in the rendered spec
The only changes are located in the SS API. Other than a few minor changes in the values of fields (like using
example.org
instead ofmatrix.org
) in several examples, the 2 following examples for the/invite
endpoints have significant changes:PUT /_matrix/federation/v1/invite/{roomId}/{eventId}
's request body example:Before:
After:
PUT /_matrix/federation/v2/invite/{roomId}/{eventId}
's request body example:Before:
After:
In both cases, the
invite_room_state
is removed, andsignatures
is added. I believe that the old example is better so we could just remove those examples.Pull Request Checklist
Preview: https://pr2076--matrix-spec-previews.netlify.app