python - Deserialize a top level list with Colander in Pyramid using Cornice -


given post request content-type: application/json , body of ["foo", "bar"] how create colander schema in pyramid using cornice deserialize this.

this i've come with:

class simplelist(colander.sequenceschema):     items = colander.schemanode(colander.string()) 

and works great in cli vanilla colander. however, when use on cornice service so:

@simple_list_service.post(schema=simplelist) def simple_list_post(request):     print(request.validated) 

i this:

{"errors": [{"name": "items", "description": "items missing", "location": "body"}], "status": "error"} 

any suggestions?

thanks!

the current version of cornice allows colander.mappingschema schema validation. else throws exception (obviously did before change made got farther).

so, unless things change, can't validate list input.


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -