maximdanilchenko / aiohttp-apispec

Build and document REST APIs with aiohttp and apispec
https://aiohttp-apispec.rtfd.io
MIT License
220 stars 58 forks source link

Incompatibility with apispec 4.0.0 -> schema2parameters() now needs an argument "location" #105

Closed Houkime closed 2 years ago

Houkime commented 3 years ago

The change was introduced in https://github.com/marshmallow-code/apispec/commit/ee8002b466aeebb753bdf93047198b3ff63f02d0

And apispec 4.0.0 went live on september 30 with this included.

The new signature is like here (openapi.py, comments included so that constraints are clearer):

 def schema2parameters(
        self, schema, *, location, name="body", required=False, description=None
    ):
        """Return an array of OpenAPI parameters given a given marshmallow
        :class:`Schema <marshmallow.Schema>`. If `location` is "body", then return an array
        of a single parameter; else return an array of a parameter for each included field in
        the :class:`Schema <marshmallow.Schema>`.

        In OpenAPI 3, only "query", "header", "path" or "cookie" are allowed for the location
        of parameters. "requestBody" is used when fields are in the body.

        https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#parameterObject
        """

(take note that "body" is not allowed in OpenAPI 3)

Houkime commented 3 years ago

Ok, so my exact problem with this (mentioned right above) was occuring on Arch Linux. requirements.txt does actually forbid apispec from crossing 4.0.0 but the Arch package

https://www.archlinux.org/packages/community/any/python-aiohttp-apispec/

does not account for that and allows to use apispec 4.0.0.

So, currently aiohttp_apispec is broken on Arch if installed from pacman and works if installed from pip. Notified maintainer.

FFY00 commented 3 years ago

cc @felixonmars

Houkime commented 3 years ago

Opened Arch bug report at https://bugs.archlinux.org/task/68874

maximdanilchenko commented 2 years ago

Closed with #115