Coder Social home page Coder Social logo

Typed parameters about jlroutes HOT 9 CLOSED

joeldev avatar joeldev commented on August 20, 2024
Typed parameters

from jlroutes.

Comments (9)

notjosh avatar notjosh commented on August 20, 2024

Instead of:
/post/view/:postID

It could be (this is format is by no means final and only meant to illustrate the concept):
/post/view/:postID

These look eerily similar ;)

from jlroutes.

joeldev avatar joeldev commented on August 20, 2024

Heh, oops. I guess it didn't like the format I proposed. :P updated it. Thanks for pointing that out!

from jlroutes.

zholmquist avatar zholmquist commented on August 20, 2024

Why not use "#" instead of ":"?

post/view/#postID

from jlroutes.

notjosh avatar notjosh commented on August 20, 2024

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?

/post/view/:[postID:number]

Since we're used to seeing (NSNumber *)postID, I'd prefer to see the type prefix the variable, such as /post/view/:[number:postID].

What types should be considered? Numbers, obviously, but what about BOOLs? Nulls? Arrays (via ?foo[]=bar&foo[]=baz)? I think I'm probably overthinking it 😄

from jlroutes.

joeldev avatar joeldev commented on August 20, 2024

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.

from jlroutes.

joeldev avatar joeldev commented on August 20, 2024

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.

from jlroutes.

joeldev avatar joeldev commented on August 20, 2024

Moving to future

from jlroutes.

zakdances avatar zakdances commented on August 20, 2024

Why not allow any object to be passed? I'd like to be able to pass NSDictionaries and my own NSObject subclasses.

from jlroutes.

joeldev avatar joeldev commented on August 20, 2024

I don't think this is worth doing. Closing.

from jlroutes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.