-
-
Notifications
You must be signed in to change notification settings - Fork 126
[schema] Correct null value handling for the AS Registration’s url property
#2130
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
Conversation
Signed-off-by: Kai A. Hiller <[email protected]>
Signed-off-by: Kai A. Hiller <[email protected]>
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.
I double-checked ruma, which is used by Conduit, just in case.
They appear to also treat url as an optional type, specifically calling out that null = don't send traffic.
So this indeed looks like a case of just fixing the schema. Various tools will thank you!
|
@anoadragon453: Ruma’s implementation does differ from what Synapse implements and the Spec now says: While the former two do not allow deserialization with a missing To unify the behavior, there are two ways forward:
I’m not quite sure what the better option is; it’s choosing between a user footgun and ugly missing-vs-null semantics. |
|
It does seem better to me to explicitly require However I recognise that this now likely means that ruma needs to implement a custom deserialiser function for this type to differentiate between I think the best way forwards is to:
I've opened an issue on ruma's issue tracker to make them aware: ruma/ruma#2074 |
|
Ruma ended up changing their implementation in ruma/ruma#2077. I've created #2155 to track the second portion of the above plan. |
…property (matrix-org#2130) Co-authored-by: Andrew Morgan <[email protected]>
Fixes the
urlproperty’s nullability of the Application Service Registration schema.The Spec states that the Registration’s
urlproperty can be “optionally set to null if no traffic is required”, but the corresponding schema does not allow this:matrix-spec/data/api/application-service/definitions/registration.yaml
Lines 21 to 23 in 23ff7f1
This PR fixes the problem by making the
urlproperty nullable, i.e., give ittype: ["null", "string"].I find this change to be between a clarification and a backwards-compatible change. Still I want to note the possibility of a Registration consumer breaking for new setups, because they didn’t expect null values for the
urlproperty to be present and will now have to handle them.In a previous iteration of this PR I additionally removed
urlfrom the list of required properties and madenullits default value. I did this to get consistent meaning for theurlproperty being unset and the property being set tonull; but I removed it, because the Synapse source code seems to consider it not a bug, but a feature:From synapse/config/appservice.py#L115-L116
Pull Request Checklist
Preview: https://pr2130--matrix-spec-previews.netlify.app