Closed Jaymon closed 6 years ago
Another way to do it would be to break out all the param stuff into a Param
class, the current interface would remain unchanged but there would be an addition of a subparams flag:
class Foo(Controller):
@paramval(0, val="one" subparams=[
Param("bar"),
Param("che")
])
@paramval(0, val="two" subparams=[
Param("baz"),
])
def GET(self, action, **kwargs): pass
I think this might be too obtuse an interface though, I'll keep thinking
class Foo(Controller):
@param(0, subparams={
"one": [
Param("bar"),
Param("che")
],
"two": [
Param("baz")
],
})
def GET(self, action, **kwargs): pass
So the subparams keys become the choices for the param.
I don't think this is applicable anymore, like https://github.com/Jaymon/endpoints/commit/686447354a6a7b9196860ab4eb8acb24676c77c7 states
Right now, say you had a controller that could have a path:
where
action
can be bar or che, so valid requests would be:I'm wondering if we could codify this with camel casing:
So camel casing class names would move through path bits. This is inspired by some comments Jarid made about us having to set a few params as optional because we had multiple action path bits that needed different attributes: