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

Combine all queries into their own section #1443

Merged
merged 6 commits into from
Aug 4, 2018

Conversation

turt2live
Copy link
Member

@turt2live turt2live commented Jul 20, 2018

Rendered: See "docs" commit status.

This removes the Directory and Profile sections, instead opting to document them as Queries.

The behaviour of profile queries is based on Synapse's behaviour. A few issues have been opened to improve the behaviour:

This fixes #1404

@turt2live turt2live added the blocked Something needs to be done before action can be taken on this PR/issue. label Jul 20, 2018
turt2live added a commit to turt2live/matrix-doc that referenced this pull request Jul 20, 2018
There isn't a whole lot to this section that needed work. The section overall lost the table schema in favour of having the endpoints close by.

The directory query is improved in matrix-org#1443
@turt2live turt2live closed this Jul 23, 2018
@turt2live turt2live reopened this Jul 23, 2018
turt2live added a commit to turt2live/matrix-doc that referenced this pull request Jul 24, 2018
There isn't a whole lot to this section that needed work. The section overall lost the table schema in favour of having the endpoints close by.

The directory query is improved in matrix-org#1443
This removes the Directory and Profile sections, instead opting to document them as Queries. 

The behaviour of profile queries is based on Synapse's behaviour. A few issues have been opened to improve the behaviour:
* matrix-org#1434
* matrix-org#1435
* https://github.com/matrix-org/matrix-doc/issues/1436
* https://github.com/matrix-org/matrix-doc/issues/1437

This fixes matrix-org#1404
This is a mix of Synapse and Dendrite behaviour, mostly Dendrite. Synapse returns `null` for field values that aren't set, however Dendrite just doesn't return them and instead opts for an empty object.

Further, synapse is lacking in error codes in this area. Dendrite does some additional validation on this API which introduces more errors for bad requests, instead of defaulting to empty objects/200 OK responses.

Likewise, Dendrite returns a 404 when the user is not found while Synapse returns 200 OK/empty object.
turt2live added a commit to turt2live/matrix-doc that referenced this pull request Jul 26, 2018
There isn't a whole lot to this section that needed work. The section overall lost the table schema in favour of having the endpoints close by.

The directory query is improved in matrix-org#1443
@turt2live turt2live removed the blocked Something needs to be done before action can be taken on this PR/issue. label Jul 26, 2018
@turt2live turt2live requested a review from a team July 26, 2018 14:46
@turt2live turt2live mentioned this pull request Jul 31, 2018
35 tasks

Directory
---------
Queries are a way to retrieve information from a homeserver abotu a resource,
Copy link
Member

Choose a reason for hiding this comment

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

abotu

description: |-
Performs a query to get the mapped room ID and list of resident homeservers in
the room for a given room alias. Homeservers should only query room aliases
that belong to the target server (idenfified by the DNS Name in the alias).
Copy link
Member

Choose a reason for hiding this comment

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

idenfified

Copy link
Member Author

Choose a reason for hiding this comment

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

I should re-learn how to type.

Performs a query to get the mapped room ID and list of resident homeservers in
the room for a given room alias. Homeservers should only query room aliases
that belong to the target server (idenfified by the DNS Name in the alias).
The target server may not appear in the resident servers list.
Copy link
Member

Choose a reason for hiding this comment

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

this is a bit ambiguous. how about "The target server may be absent from the resident servers list."

Copy link
Member

Choose a reason for hiding this comment

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

In fact I question the value of this, given it's not entirely clear what "the resident servers list" refers to, and we already have "This list may or may not include the server answering the query" below.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the statement later on should be okay, meaning this one can just be removed.

servers:
type: array
description: |-
An array of server names that are likely to hold then given room. This
Copy link
Member

Choose a reason for hiding this comment

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

s/then/the/

that belong to the target server (idenfified by the DNS Name in the alias).
The target server may not appear in the resident servers list.

Servers may wish to cache the response to this query to prevent requesting the
Copy link
Member

Choose a reason for hiding this comment

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

s/prevent/avoid/ ?

$ref: "../client-server/definitions/errors/error.yaml"
examples:
application/json: {
"errcode": "M_UNKNOWN",
Copy link
Member

Choose a reason for hiding this comment

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

I'm really not keen on speccing M_UNKNOWN here.

Copy link
Member

Choose a reason for hiding this comment

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

I guess it's only an example, but still.

}
400:
description: |-
The room alias is not hosted on the server. This can happen if the directory
Copy link
Member

Choose a reason for hiding this comment

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

this implies that this is the only reason we would return a 400.

I'm not sure I'd bother speccing this as it currently stands - asking example.org for a matrix.org alias is just an invalid request like any other. Typically we don't spell out such things.

Copy link
Member Author

Choose a reason for hiding this comment

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

The only reason I've specified the 400 for this case is because it felt like a gotcha that can be easily hit. I suppose the text in the description asking for the caller to use the right server is a good enough hint though...

for a given user. Homeservers should only query profiles for users that belong
to the target server (identified by the DNS Name in the user ID).

Servers may wish to cache the response to this query to prevent requesting the
Copy link
Member

Choose a reason for hiding this comment

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

s/prevent/avoid/

}
400:
description: |-
The request was missing parameters or had invalid values for the parameters. This
Copy link
Member

Choose a reason for hiding this comment

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

can we make it explicit that the list of reasons is not exhaustive?

Copy link
Member Author

Choose a reason for hiding this comment

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

Like the directory query, I think this can actually just disappear - the gotcha is covered in the description.

@turt2live
Copy link
Member Author

Thanks for reviewing this. Clearly it's suffered the result of my train of thought where parts get documented ahead of others, and things didn't get shuffled around like they normally do before opening the PR. Sorry about that :(

Will address the concerns, and double check the other PRs to avoid excess review time.

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

lgtm

@turt2live turt2live merged commit dea16e9 into matrix-org:master Aug 4, 2018
@turt2live turt2live deleted the travis/s2s/query branch August 4, 2018 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

spec profile query
2 participants