Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schemas can't be classes since 4.0.0 #523

Closed
abompard opened this issue Dec 2, 2019 · 1 comment · Fixed by #524
Closed

Schemas can't be classes since 4.0.0 #523

abompard opened this issue Dec 2, 2019 · 1 comment · Fixed by #524

Comments

@abompard
Copy link

abompard commented Dec 2, 2019

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.

@leplatrem
Copy link
Contributor

You're right!

Will see if we can release 4.0.1 with a quick fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants