matrix-org / matrix-org/matrix-spec

Confusing username availability API

Open
#465 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-Client-Server enhancement
Dominant language
HTML
Stars
330
Forks
150
Avg merge
2h 21m
Merged PRs (30d)
3

Description

The API to check availability of a username ([`GET /_matrix/client/r0/register/available`][api]) communicates the availability by either returning `200 Success` or `400 Bad Request` with an error code.

However, the response body in a `200 Success` return also contains an object wrapping a boolean `available` value. This value is described in the spec as always being set to `true` when returned in a 200 response. Which in effect means "this is a constant true value", because the `available` boolean does not exist on non-200 responses. So it doesn't really fill any purpose.

This feels a bit confusing. Adding to the confusion is the fact that when a username is taken the API responds by telling the caller "your API request was invalid", when that shouldn't be the case. Asking if the username "Foo" is taken is a valid request, even if the username happens to be taken (in my mind, at least).

Maybe this can be changed to be less confusing? Changing what it returns would likely be a breaking change though.

[api]: https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-client-r0-register-available

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with issue 465 and the Matrix Client-Server r0.4.0 specification section for GET /_matrix/client/r0/register/available. Review the existing 200 and 400 response definitions and determine the intended semantics before proposing a change. Done means the behavior is agreed and the affected specification text consistently documents it.

Written by the indexing model from the issue text.

Assessment

Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.