Add groundwork for new versions of federation APIs#4390
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #4390 +/- ##
===========================================
- Coverage 73.67% 73.66% -0.01%
===========================================
Files 300 300
Lines 29815 29817 +2
Branches 4897 4897
===========================================
- Hits 21965 21964 -1
- Misses 6408 6412 +4
+ Partials 1442 1441 -1
Continue to review full report at Codecov.
|
richvdh
left a comment
There was a problem hiding this comment.
looks fine. Per my comments I'm not entirely sure there is any value in having the v1 and v2 in constants rather than just treating it as part of the endpoint name, but if you'd rather leave it that's fine.
|
|
||
| def register(self, server): | ||
| pattern = re.compile("^" + PREFIX + self.PATH + "$") | ||
| pattern = re.compile("^" + self.PREFIX + self.PATH + "$") |
There was a problem hiding this comment.
I'm unconvinced that:
PATH = "/invite/(?P<context>[^/]*)/(?P<event_id>[^/]*)"
PREFIX = FEDERATION_V2_PREFIX
is clearer than
PATH = "/v2/invite/(?P<context>[^/]*)/(?P<event_id>[^/]*)"
(in other words: although it's a ballache, would it be better to go through adding /v1 to the starts of all the PATHs?)
| """ | ||
| return prefix + path % tuple(urllib.parse.quote(arg, "") for arg in args) | ||
| return ( | ||
| FEDERATION_V1_PREFIX |
There was a problem hiding this comment.
related to my other comment: we may as well hardcode /v1 here.
|
I was vaguely copying it from how we do the CS API. Broadly, there the reason to not encode the version in the path is that some endpoints are shared across multiple versions/releases. I don't know if the same will happen to federation API, but it feels somewhat likely. Though I guess the way that the CS API does this is to actually just have a |
|
In the interest of moving things along, I'm going to merge this as is. I don't think the current way is particularly bad, though I do take your point about whether its worth it. Let's revisit this when we come to figuring out if we want to cut a full |
I feel like I have already figured this out: we do not. |
This will be needed for things like MSC1794 (assuming that some form of it gets accepted)