rest_toolkit
rest_toolkit copied to clipboard
Path to resources
There is no real samples of use, so I've been trying (and failing) to figure out how one is expected to configure nested resources... For example:
- /observatories
- /observatories/1
- /observatories/1/telescopes
- /observatories/1/telescopes/2
So for the above I have 4 resources defined, 2 collections ObservatoryCollection
and TelescopeCollection
as well as ObservatoryResource
and TelescopeResource
. I could not find a way to declare nested resources through the API, so the telescopes one above are basically done with:
@resource(r'/observatories/{id:\d+}/telescopes')
Now I want to also access telescopes directly, like:
- /telescopes
- /telescopes/2
Figuring this would work the same as the @view_config
Pyramid decorator, I optimistically just added a second @resource
to the TelescopeCollection
and TelescopeResource
, but this does not work., raising an pyramid.exceptions.ConfigurationConflictError
exception.
Is this not possible? Am I supposed to declare the nested resources in the above manner?