Given a POST request with Content-Type: application/json
and a body of ["foo", "bar"]
how do I create a Colander schema in Pyramid using Cornice to deserialize this.
This is what I've come up with:
class SimpleList(colander.SequenceSchema):
items = colander.SchemaNode(colander.String())
And it works great in the CLI with vanilla Colander. However, when I use it on a Cornice Service like so:
@simple_list_service.post(schema=SimpleList)
def simple_list_post(request):
print(request.validated)
I get this:
{"errors": [{"name": "items", "description": "items is missing", "location": "body"}], "status": "error"}
Any suggestions?
Thanks!