Cornices/cornice

Schemas can't be classes since 4.0.0

Closed this issue · 1 comments

After commit 40ed37a and the release of 4.0, all schema arguments need to be instances (because of the isinstance() call), while Cornice accepted classes before that. I don't think the "classes" behavior has been deprecated, but I may be wrong.
I did this kind of change on all schema arguments and it stopped crashing:

@@ -186,7 +186,7 @@ def query_comments(request):
     )
 
 
-@comments.post(schema=schemas.SaveCommentSchema,
+@comments.post(schema=schemas.SaveCommentSchema(),
                renderer='json',
                error_handler=services.errors.json_handler,
                validators=(

It's not a big fix but it took some time chasing it down. A DeprecationWarning when schemas are classes instead of instances would have been appreciated.

You're right!

Will see if we can release 4.0.1 with a quick fix