-
Notifications
You must be signed in to change notification settings - Fork 378
Change Capabilities format #6572
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
Change Capabilities format #6572
Conversation
3f1a071
to
53614b5
Compare
bd8d695
to
7cf8740
Compare
7cf8740
to
c7fee87
Compare
IMO, 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.
LGTM.
Some nitpicks below.
This changes the (de-)serialization of capabilities that are broadcast via synapse `avatar_url` to be url query parameters. The new capabilities serialization format in detail: Capabilities are serialized to `avatar_url` as mxc://raiden.network/cap?{capabilities_url_encoded} The spec for `{capabilities_url_encoded}` is as follows: - `bool` values are encoded as `'1' == True` and `'0' == False` - other values are encoded as strings - the strings `'0'` and `'1'` are deserialized as `bool` (see above). - other strings are kept as they are - multiple entries / list values are allowed - final interpretation of any value is up to the client Changes in detail: - hand rolled serialization is removed - truncation of falsy entries is dropped / all entries are explicit - unknown capabilities will be preserved - `parse_capabilities` is renamed to `deserialize_capabilities` - deserialization errors are treated as empty capabilities - adjusted unit tests
28c861a
to
a207ddc
Compare
a207ddc
to
b75c6f8
Compare
Description
This changes the capabilities according to the proposed changes in #6503 (comment) and/or #6503 (comment)
Fixes: #6503
copy and past from the issue:
Encoding/Serialization for use in matrix
avatar_url
"mxc://raiden.network/cap?{capabilities_url_encoded}"
where
{capabilities_url_encoded}
is the url query parameter encoding of capabilities.Rules for url encoding:
bool
values are encoded as"0"
forFalse
and"1"
forTrue
Deserialization / Decoding
The final interpretation of capability values is up to the receiving client, or rather the specified capability.
Implicit values / Handling of unknown values
Previously discussed versioning is postponed until there is a need for truncation of capabilities.
Example
Rationale for the decision
json
+base64
encoding was dropped because it is harder to inspect by humansboolean
convention (0,1
) was necessary because there is no native format for boolean values in url parameters