Skip to content
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

Make TrieRouter register/unregister receive URLs 📒 #246

Merged
merged 1 commit into from
Sep 1, 2021

Conversation

p4checo
Copy link
Member

@p4checo p4checo commented Sep 1, 2021

Checklist

Motivation and Context

When we updated Router and RouteHandler to have an additional R: Routable associated type, we also migrated all public TrieRouter APIs to receive an R instance, replacing URL.

However, the main purpose of the new R: Routable is to allow having more data when effectively being routed (i.e. in route()), and not on all other "events", like registering/unregistering routes.

So, if we for instance define R as being some sort of HTTP request type (which makes total sense to be routed), it doesn't make much sense to use that same type to register/unregister routes, because it forces us to create "dummy" requests only for those purposes.

With that in mind, TrieRouter register() and unregister() now expect (annotated) URLs like before, and only receive an R instance in route().

Description

  • Update TrieRouter register() and unregister() receive a URL route.

  • Update some TrieRouter public API documentation.

When we updated `Router` and ``RouteHandler` to have an additional
`R: Routable` associated type, we also migrated all public `TrieRouter`
APIs to receive an `R` instance, replacing `URL`.

However, the main purpose of the new `R: Routable` is to allow having
more data when effectively _being routed_ (i.e. in `route()`), and not
on all other "events", like registering/unregistering routes.

So, if we for instance define `R` as being some sort of HTTP request
type (which makes total sense to be routed), it doesn't make much sense
to use that same type to register/unregister routes, because it forces
us to create "dummy" requests only for those purposes.

With that in mind, `TrieRouter` `register()` and `unregister()` now
expect (annotated) URLs like before, and only receive an `R` instance
in `route()`.

## Changes

- Update `TrieRouter` `register()` and `unregister()` receive a `URL`
route.

- Update some `TrieRouter` public API documentation.
@codecov
Copy link

codecov bot commented Sep 1, 2021

Codecov Report

Merging #246 (a608712) into master (23ebbba) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #246   +/-   ##
=======================================
  Coverage   94.94%   94.94%           
=======================================
  Files          97       97           
  Lines        3266     3266           
=======================================
  Hits         3101     3101           
  Misses        165      165           
Impacted Files Coverage Δ
Sources/DeepLinking/Route+TrieRouter.swift 91.78% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 23ebbba...a608712. Read the comment docs.

@p4checo
Copy link
Member Author

p4checo commented Sep 1, 2021

Thanks for the supersonic review @filipe-lemos! 🙇🏼

@p4checo p4checo merged commit d398f3b into master Sep 1, 2021
@p4checo p4checo deleted the register-unregister-urls-in-trie-router branch September 1, 2021 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants