You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -96,17 +96,19 @@ passes the rest onto the following (when there are composed). For example, if yo
96
96
string "foo", and an other that matches an `Int`, if you give the composition "foo/22", the first `PathSegment` consumes
97
97
"foo" and passes "22" to the next one, which will them consume it.
98
98
99
+
> Important (since 0.7.0 💥): the `PathSegment` has to fully match the path in order to succeed. If there is a left over segment after, then it will not match. You can use `ignoreRemainingSegments` if you want to only match the "beginning" of the path.
100
+
99
101
#### Built in path segments
100
102
101
103
There are a bunch of `PathSegment`s that are already defined, and should satisfy most of your basic needs. For example,
102
104
the following things are implemented (you can look at the companion object of `PathSegment` to have the comprehensive
103
-
list:
105
+
list):
104
106
105
107
-`root`: matches everything and passes all segments onto the next
106
108
-`segment[T]` matches an element of type `T`, whose information is contained in only one segment, and passes the other
107
109
segments onto the next
108
-
-`endOfSegments`: which matches only the empty list of segments, and thus passes nothing onto the next (there should
109
-
never be a next, though)
110
+
-`remainingSegments`: consumes all the remaining segments, returning the list
111
+
-`ignoreRemainingSegments`: consumes all the remaining segments and ignore their content
url-dsl was thought with one possible goal in mind, the one of creating a routing system. An example of how to do that can be found [here](shared/src/test/scala/urldsl/examples/RouterUseCaseExample.scala).
280
282
283
+
## Moving from 0.6.x to 0.7.x
284
+
285
+
There is a breaking change introduced in 0.7.0. If a `PathSegment` only partially match the path, then it will fail. If you were relying on this behaviour, you need to add `/ ignoreRemainingSegments` to your `PathSegment` instances.
286
+
281
287
## Moving from 0.4.x to 0.5.x
282
288
283
289
In 0.5.0 we replaced our `Tupler` with the `Composition` type from the [tuplez](https://github.com/tulz-app/tuplez) library. It works exactly the same for most use cases, but if your data types are complex enough that URL-DSL previously gave you nested tuples, those tuples will generally be flattened now.
0 commit comments