-
Notifications
You must be signed in to change notification settings - Fork 13
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
Use URI-templates #5
Comments
+1 for this specification over the :identifier one. I'm glad this issue was opened to discuss this. Did you got any feedback on this so far? |
Actually, these are just notes about the questions we had when writing the spec, that somehow were not removed afterward. : is a reserved character in URLs, it is quite unlikely to appear in the path of an API method. Hence, no escaping mechanism needed in practice if not in theory.
In truth, we didn't know about URI-templates when we wrote the spore specifications. We choose to go with the : syntax because it was already widely used server-side (by Rails, Dancer, Compojure and surely countless others...) and so already familiar to most. About docrouter, we are indeed working on the wheel, but not for the same vehicle I guess. Specifically, SPORE was designed not to go the WADL route, as we found the spec to be too verbose and cumbersome to read and to write. As such, SPORE does minimum param validation (and nothing about those in BODY, though we are thinking about that), and does not specify anything except status code about the response. A SPORE spec can be written in 5 minutes while reading the documentation of an API or writing the routes of the server, which is exactly what we wanted. |
We cannot break compatibility with existing code. I try it in a branch of lua-Spore |
From the spec:
XXX How can non-placeholder :foo's be included in the path? i.e. is there an escape mechanism? XXX What happens in this example if 'format' isn't listed in params/required? XXX What happens if a parameter needs to be followed by a word character? i.e. can something like :{format}foo be used?
I would suggest using http://tools.ietf.org/html/rfc6570 URI-templates rather than the template format you use now. If you don't want to mandate a fully compliant implementation as part of SPORE, then "level 1" templates are extremely simple, (basically you replace :foo with {foo})
Tangentially, I'd appreciate your input over on anodejs/node-docrouter#1, it seems as though we all may be re-inventing the same wheels.
The text was updated successfully, but these errors were encountered: