Repository navigation
Bulk destroy answers each key's outcome; destroy returns {pk: None} (0.15.0) - #81
Merged
Merged
Conversation
…ares
perform_destroy returned {"id": pk}, which does not validate as destroy's
dict[K, Any]: REST answered 500, and a celery_viewset worker failed the
call with action_failed (reason: result). 0.14.3.
✅ Incremental coverage — 96.3%
19 files not graded (6 ignored by pattern, 1 no added lines, 12 not source files)
Coverage reports: coverage.json (coverage.py, 69 files) · coverage/clover.xml (clover, 13 files) — incremental-coverage-check v3.0.0 |
bulk_destroy deletes every key independently and answers 200 with one object
keyed by pk: null for a deleted record, the failure's ApiErrorBody otherwise.
ImplMixin.perform_bulk_destroy implements it over perform_destroy; the
CollectionViewSet and DjangoORMViewSet overrides are removed. destroy returns
{pk: None}. ChangeEvents publishes only the deleted pks of a bulk destroy.
TS: DestroyReturnData<K>, BulkDestroyReturnData<K>.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
bulk_destroydeletes each key independently of the others and answers 200 with one object keyed by pk:nullfor a deleted record, the failure'sApiErrorBodyotherwise (fastapi-viewsets.not_foundfor a missing record).perform_bulk_destroyreturnsdict[K, ApiErrorBody | None].ImplMixin.perform_bulk_destroyhas a default overperform_destroy: anHTTPExceptionorRequestValidationErrorbecomes that key'sApiErrorBody, any other exception propagates, a repeated key is deleted once.CollectionViewSetandDjangoORMViewSetuse it.destroy/perform_destroyreturndict[K, None].DjangoORMViewSet.perform_destroyreturned{"id": pk}, which failed response validation (500) for a non-string key and did not encode as the declared result in acelery_viewsetworker (500fastapi-viewsets.action_failed,reason: result).ChangeEventspublishes only the deleted pks of a bulk destroy.DestroyReturnData<K>=Record<K, null>;bulkDestroy()returnsBulkDestroyReturnData<K>=Record<K, ApiErrorBody | null>.Breaking: 0.15.0 for both packages. The TODO entry on the non-atomic Django bulk destroy is removed.
Tests
CollectionViewSet).ActionCodec.