alysivji / falcon-apispec

apispec plugin that generates OpenAPI specification (aka Swagger Docs) for Falcon web applications.
MIT License
44 stars 31 forks source link

Support for Multi-Responders with the same method type #30

Open Sylphe88 opened 3 years ago

Sylphe88 commented 3 years ago

This is my take on this feature about supporting multiple routes/Falcon responders, some of which may be suffixed and use the same HTTP method type, e.g. on_get and on_get_hello. The plugin is still immutable when parsing the uris, and the only constraint for the user who wants to expose the docstring for all the routes is to register the path for all the suffixes just like in ebensonwwg's PR, but specifically passing this suffix. This does not look as "weird" as N+1 identical lines, and allows for selecting the suffix'ed methods to be registered. As mentioned here, APISpec registers one and only one path per spec.path() call, and a path cannot have multiple GETs or POSTs, so we're kind of doomed to call spec.path() multiple times.

As a bonus I also improved the tox configuration, and used bump2version to easily bump new releases.

Sylphe88 commented 3 years ago

@alysivji it'd be nice if you could look into this PR or the others related to this feature, I believe it's a much needed improvement to the package (still had a friend/colleague last week asking for it and had to point him to my fork). If you don't have time, you may search for additional maintainers so the package does not just die

aescolastico commented 2 years ago

@alysivji Can we please get some attention for this PR? This is a very common use case in falcon for collection/singleton resource strategies.