Skip to content
Advertisement

Call marshmallow validated GET endpoint with List parameter

I have a marshmallow schema validation like this:

JavaScript

Then in my endpoint I call the schema validation: MyFilterSchema().load(flask.request.args) Now I try to call the HTTP GET endpoint which is using this validation. But I get 'ids': ['Not a valid list.'] I tried different ways:

JavaScript

but no luck. How must the endpoint be called that marshmallow recognizes my GET parameter as list?

Advertisement

Answer

One way is to use a custom implementation of a validation field instead of the integrated list field.

JavaScript

This can be used in the schema as follow:

JavaScript

and would accept calls in the format:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement