-
-
Notifications
You must be signed in to change notification settings - Fork 159
Open
Labels
Description
Hi,
I'm using axios to send a GET request to my flask-smorest endpoint.
I know there's no real agreement on this spec-wise, but the request's querystring contains an array, and axios sends it in this format:
http://127.0.0.1:5000/api/v1/items/?types[]=cd&types[]=dvd
I've defined the schema used for reading the arguments as
class FilterSchema(ma.Schema):
...
types = ma.fields.List(ma.fields.String(), missing=[])
Yet when I try to read the data received in my endpoint, types is empty:
@items_blp.route('/')
class ItemCollection(MethodView):
@items_blp.arguments(FilterSchema(unknown=ma.EXCLUDE), location="query")
@listings_blp.response(ItemSchema(many=True))
def get(self, payload):
# payload['types'] is empty...
if payload['types']:
qs = Item.objects.filter(item_type__in=payload['types'])
return qs
Is this a missing feature in flask-smorest or should I ask on SO whether I should use another way to pass data?