-
Notifications
You must be signed in to change notification settings - Fork 695
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
Typed parameters #1
Comments
These look eerily similar ;) |
Heh, oops. I guess it didn't like the format I proposed. :P updated it. Thanks for pointing that out! |
Why not use "#" instead of ":"? post/view/#postID |
Why use "#" instead of ":"? I'd prefer ":" unless there's a real reason. "#" has other semantic meaning on web URLs - is that an issue here?
Since we're used to seeing What types should be considered? Numbers, obviously, but what about BOOLs? Nulls? Arrays (via |
Yeah I'm still trying to figure out what types make sense. Numbers and BOOLs are the most obvious choices. Arrays are good too but there seems to be no actual standard about how arrays are represented in URLs, so I'm a bit cautious of that. I've seen key=value1&key=value2&key=value3, I've seen the one you suggested, and I've even seen weird things like key=[value1,value2,value3]. I don't really like any of them so I'm not sure how to just 'pick' one to be a standard. |
The other issue that I see here is that there isn't really an elegant way to handle typed URL parameters (read: GET params). Maybe that's okay? I even use a "debug=true" GET param example in the readme, but there would be no way to actually just tell JLRoutes that that's a BOOL even though you could tell it that any other regular parameter is a BOOL. |
Moving to future |
Why not allow any object to be passed? I'd like to be able to pass NSDictionaries and my own NSObject subclasses. |
I don't think this is worth doing. Closing. |
Currently all parsed params come in as strings. While that's useful a lot of the time, there are still probably some cases where the developer has to convert it to, for example, a number.
In the interest of helping people not have to write that extra bit of code, I'd like to find some nice way to encode types in the route pattern string.
Instead of:
/post/view/:postID
It could be (this format is by no means final and only meant to illustrate the concept):
/post/view/:[postID:number]
JLRoutes would see that postID is declared as a number and just give you an NSNumber for that key instead of an NSString.
There is probably some set list of types where this makes any sense at all whatsoever.
The text was updated successfully, but these errors were encountered: