-
Notifications
You must be signed in to change notification settings - Fork 9
Add meta namespace for annotations; v0.5.5 #52
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
|
/cc @wikimedia/services |
wikimedia/swagger-router#52 introduces a separation between metadata-only nodes & actual routes. This separation avoids conflicts, like metadata-only nodes overriding wildcard matches. This patch uses this separation in hyperswitch to store API root information. Depends on: wikimedia/swagger-router#52 / swagger-router v0.5.5.
|
Hm... This seems VERY magical and at least needs some documentation. But overall, can we just revert the order of comparations to try matching |
I think we still want an explicit route at / to override the wildcard match, which is the curent precedence. It is also consistent with the precedence between other explicit nodes vs. a wildcard. If we wanted to implement a handler-based fallback in swagger-router, we would need to inspect the node |
|
Aha, ok, I didn't completely understand what was happening writing the previous comment. Indeed without this meta key we'll either be able to provide the spec or match the route with LGTM overall, but could you add some documentation about special handling of the meta key type? |
So far we used the magic '' node (URL ending in slash) to attach
metadata like API specs. Since we used a regular path, requests for /
would match this metadata node, despite it not necessarily having any
handlers. As a result, handlers registered for a wildcard (ex:
`{+path}`) were never reached.
This patch avoids this interference by separating metadata out into a
separate 'meta' lookup level. At the node level, this is represented by
the use of the 'meta_' prefix. As a result, regular lookups for URLs
ending in a slash do not match metadata-only nodes any more, which means
that wildcard handlers can kick in as expected. Among other things, this
makes it possible to register wildcard handlers at the API root, such as
`/{+path}`.
|
@Pchelolo, I added doc comments to the setChild / getChild methods detailing the supported kinds of segments / keys. |
|
@gwicke Sweet! Waiting for travis and merging |
wikimedia/swagger-router#52 introduces a separation between metadata-only nodes & actual routes. This separation avoids conflicts, like metadata-only nodes overriding wildcard matches. This patch uses this separation in hyperswitch to store API root information. Depends on: wikimedia/swagger-router#52 / swagger-router v0.5.5.
So far we used the magic '' node (URL ending in slash) to attach
metadata like API specs. Since we used a regular path, requests for /
would match this metadata node, despite it not necessarily having any
handlers. As a result, handlers registered for a wildcard (ex:
{+path}) were never reached.This patch avoids this interference by separating metadata out into a
separate 'meta' lookup level. At the node level, this is represented by
the use of the 'meta_' prefix. As a result, regular lookups for URLs
ending in a slash do not match metadata-only nodes any more, which means
that wildcard handlers can kick in as expected. Among other things, this
makes it possible to register wildcard handlers at the API root, such as
/{+path}.