Cornices / cornice

Build Web Services with Pyramid.
https://cornice.readthedocs.io
Other
384 stars 149 forks source link

Cornice API with optional path parameter #548

Open tflorac opened 3 years ago

tflorac commented 3 years ago

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:

So is this syntax supported by Cornice, or should I handle it in another way?

Best regards,

Thierry

leplatrem commented 3 years ago

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: https://github.com/Cornices/cornice/blob/54e29682e4f22b9ad944c1f96c24a6972937fb1f/cornice/pyramidhook.py#L191-L264

Alternatively, you can register several routes in the right order to obtain the same result