Skip to content

Allow custom APISpec plugins #349

@ndawn

Description

@ndawn

APIFlask currently doesn't allow including a custom APISpec plugin.

The suggestion is to add such feature to APIFlask. It would look like this (param name is negotiable):

app = APIFlask(
    ...,
    apispec_plugins=[SomeCustomPlugin()],
)

And the code change according to proposed feature would look like this:

class APIFlask(APIScaffold, Flask):
    ...
    # pass plugins list all the way through APIFlask __init__()
    # or instead it could be assigned as instance attribute on __init__() and used as self.plugins then
    def _generate_spec(self, plugins: list[apispec.BasePlugin]) -> APISpec:
        ...
        spec: APISpec = APISpec(
            ...,
            plugins=[ma_plugin, *plugins],
            ...,
        )
        ...
    ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions