Skip to content

Using a dict of fields for arguments #180

Description

@AbdealiLoKo

In the docs, I see there is a way to do: @blp.arguments(PetSchema)
Is there a way to simply do: @blp.arguments({'name': ma.fields.Str()}) ?

I was trying to port some of my projects from flaks-apispec to flask-smorest and in flask-apispec I was doing: @use_kwargs({'name': ma.fields.Str()}) a lot as that seemed generic and easy to define for my endpoints with simple query params.
I didn't see a similar thing in smorest, and was wondering if I have to define a schema every time ?

I don't like schemas too much because they become a bit verbose for 1 or 2 arguments ... and then in cases where I need borh a query-param and a body as arguments (POST with query params) I need to define 2 schemas - which seems to be confusing

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions