Enforce is_valid(raise_exception=False) as a keyword-only argument.#7952
Enforce is_valid(raise_exception=False) as a keyword-only argument.#7952lovelydinosaur merged 2 commits intoencode:masterfrom
is_valid(raise_exception=False) as a keyword-only argument.#7952Conversation
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
is_valid(raise_exception=False) as a keyword-only argument.
|
This seems like it could be a pretty reasonable change to me, along with a major version bump. Granted there's probably some codebases that might be forced into a change, OTOH, it is an argument that makes much more sense as a keyword-only case. Any other maintainers have an opinion on the trade-off here? |
|
I like it! This avoids a problem known as "the boolean trap". |
|
It like it too, but it breaks the existing API and changelog doesn't mention that :( |
|
It's in https://www.django-rest-framework.org/community/3.14-announcement/ and https://www.django-rest-framework.org/community/release-notes/ But yes, upgrades that break things are a pain. Even when we want them. |
|
OK, then it would make sense to include a link to the former in the latter, as originally I only found and read the latter (as I was reviewing tons of changelogs for multiple packages which got updated for my project). Additionally I'd suggest explicitly marking breaking changes with some prefix / tag / whatever ("BREAKING: ...") to make sure no one will miss that. Anyway, keep up the good work! |
…encode#7952) * make raise_exception a keyword-only argument * make raise_exception keyword-only in metaclass
At the moment
is_validcalls are possible without keyword-only arguments, so codeserializer.is_valid(True)is possible and will be quite misleading, especially for new developers. This pull requests makes "raise_exception" name mandatory if serializer is called with argument.