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

Responses schema fixes #3650

Merged
merged 6 commits into from Jan 31, 2022
Merged

Responses schema fixes #3650

merged 6 commits into from Jan 31, 2022

Conversation

afranke
Copy link
Contributor

@afranke afranke commented Jan 17, 2022

Fixes #2237.

Corrects the response schemas for:

PUT /user/{user_id}/account_data/{account_dataType}
PUT /user/{user_id}/rooms/{roomId}/account_data/{type}
PUT /directory/list/room/{roomId}
PUT /sendToDevice/{eventType}/{txnId}
POST /account/3pid
POST /account/3pid/add
POST /account/3pid/bind

Preview: https://pr3650--matrix-org-previews.netlify.app

@afranke afranke requested a review from richvdh January 17, 2022 08:01
Copy link
Member

@turt2live turt2live left a comment

Choose a reason for hiding this comment

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

It looks like some of these are introducing response bodies rather than clarifying them - evidence to support that synapse has always done this would be appreciated, otherwise an MSC is likely required.

@afranke
Copy link
Contributor Author

afranke commented Jan 18, 2022

I have now checked in Synapse and can confirm that all these responses have a return 200, {}.

PUT /user/{user_id}/account_data/{account_dataType}
PUT /user/{user_id}/rooms/{roomId}/account_data/{type}
PUT /room_keys/version/{version}
PUT /directory/list/room/{roomId}
PUT /sendToDevice/{eventType}/{txnId}

Is that enough for you?

@turt2live
Copy link
Member

for the endpoints we mostly just need evidence that it's always returned these things prior to 1.0 (roughly).

Adjusted links to account for time:
PUT /user/{user_id}/account_data/{account_dataType}
PUT /user/{user_id}/rooms/{roomId}/account_data/{type}
PUT /room_keys/version/{version} (intent carried from unstable implementation)
PUT /directory/list/room/{roomId}
PUT /sendToDevice/{eventType}/{txnId}

@turt2live turt2live dismissed their stale review January 18, 2022 16:28

concern addressed

@richvdh
Copy link
Member

richvdh commented Jan 18, 2022

for the endpoints we mostly just need evidence that it's always returned these things prior to 1.0 (roughly).

Adjusted links to account for time:
PUT /user/{user_id}/account_data/{account_dataType}
PUT /user/{user_id}/rooms/{roomId}/account_data/{type}
PUT /room_keys/version/{version} (intent carried from unstable implementation)

The link here is for the DELETE handler, though much the same applies to the PUT handler (added in synapse#4580. That PR formed the basis for MSC1219, which explicitly says that this endpoint "returns the empty JSON object".

PUT /directory/list/room/{roomId}
PUT /sendToDevice/{eventType}/{txnId}

Not mentioned here are:

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.

this is fine except... it doesn't seem to have worked? None of the modified endpoints (with the exception of /account/3pid, which has a non-empty body) show a response body in the preview.

@richvdh
Copy link
Member

richvdh commented Jan 18, 2022

also, you might want to merge in main, to pick up 97a8b0b, to fix the CI

@afranke
Copy link
Contributor Author

afranke commented Jan 19, 2022

this is fine except... it doesn't seem to have worked? None of the modified endpoints (with the exception of /account/3pid, which has a non-empty body) show a response body in the preview.

As I said in the review-conversation above, it does work: the artifact contains the expected bits and this can be verified by opening the file with a viewer.

also, you might want to merge in main, to pick up 97a8b0b, to fix the CI

This goes beyond my understanding of Github Pull Requests and Reviews, in the sense that I don’t know how to do that in a way that I am certain will not break something for someone here. With Gitlab, I know that I could just rebase the branch on top of main and everything would be fine for everyone, but I know doing this with Github makes everyone unhappy.

Since we know for a fact the red thing in CI is fixed in main, has nothing to do with the changes here, and this PR will end up “Squashed and merged” anyway, do we really need to worry about this?

@richvdh
Copy link
Member

richvdh commented Jan 19, 2022

do we really need to worry about this?

no, but it's easier just to do it than verify the cause of the CI failure:

git fetch
git merge origin/main
git push

and yes, please don't rebase!

@afranke
Copy link
Contributor Author

afranke commented Jan 26, 2022

It looks like some of these are introducing response bodies rather than clarifying them - evidence to support that synapse has always done this would be appreciated, otherwise an MSC is likely required.

Considering this has been confirmed to be synapse’s behaviour, is clarification indeed the type I need to add for the changelog?

@richvdh
Copy link
Member

richvdh commented Jan 26, 2022

Considering this has been confirmed to be synapse’s behaviour, is clarification indeed the type I need to add for the changelog?

Yes I think so. Thanks!

Comment on lines +301 to -303
examples:
application/json: {}
schema:
type: object
properties: {}
Copy link
Member

Choose a reason for hiding this comment

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

For the record, I think this ends up being pretty much a no-op. An object with no properties is the same as one with an empty properties, and the auto-generated example looks the same as the one we are creating here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe, but that wouldn’t be consistent with what we have for other cases. Is there anything to change here or can we mark this resolved?

Copy link
Member

Choose a reason for hiding this comment

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

nope, just calling it out explicitly for future reference. I'd leave the thread open for future viewers.

@richvdh
Copy link
Member

richvdh commented Jan 26, 2022

(have updated the PR description to make it clear which endpoints we're fixing here)

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 other than the changelog.

changelogs/client_server/newsfragments/3650.clarification Outdated Show resolved Hide resolved
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
@richvdh richvdh merged commit d3e3956 into main Jan 31, 2022
@afranke afranke deleted the responses-schema-fixes branch January 31, 2022 12:55
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.

Missing "Response format" for POST /account/3pid
4 participants