parseAsTuple #1019
-
There have been a few situations where this would be useful, so I wanted to suggest it. For example, a date range parser could be implemented as: parseAsTuple([parseAsIsoDate, parseAsIsoDate]) Advantages over
Just an example there are obviously many others. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
That's a good idea, would you like to open a PR? I like the tuple approach, as it's not as opinionated as a range (where terminology of min/max, from/to, start/end, left/right etc would get in the way), and not potentially fixed to two values (a
That also makes sense, in the example above (map coordinates), the 3rd coordinate (zoom) is generally an integer while the other ones are floats (with different constraints on values). This can be reflected in the type, but also in the kind of serialisation/deserialisation being done. The implementation should likely:
Edit: upgrading this discussion to an issue for tracking: #1022. |
Beta Was this translation helpful? Give feedback.
That's a good idea, would you like to open a PR?
I like the tuple approach, as it's not as opinionated as a range (where terminology of min/max, from/to, start/end, left/right etc would get in the way), and not potentially fixed to two values (a
?coordinates=12.34;56.78;9
could make sense for a 3D coordinate system encoded into a single search param)That also makes sense, in the example above (map coordinates), the 3rd coordinate (zoom) is generally an integer while the other ones are floats (with different constraints on values). This can be reflected in the type, but also in the kind of serialisation/deserialisation …