Cornice API with optional path parameter
Opened this issue · 1 comments
tflorac commented
Hi,
I'm trying to build a Cornice service which should accept an optional path parameter, so I followed Pyramid guidelines and set path as "/api/rest/doc/{doc_id}{version:.*}
".
But then:
- when defined,
request.matchdict['version']
is set to "/1
" (for example), instead of just "1
", as described in Pyramid documentation; - when using Swagger extension, I only see a single parameter called "
doc_id}{version
"!
So is this syntax supported by Cornice, or should I handle it in another way?
Best regards,
Thierry
leplatrem commented
Hi Thierry,
To be honest with you I never used these optional path parameters.
Based on your feedback, it looks like Cornice does not support them well.
It doesn't mean it couldn't, if you want to track this down, the view registering code is this:
cornice/cornice/pyramidhook.py
Lines 191 to 264 in 54e2968
Alternatively, you can register several routes in the right order to obtain the same result