Skip to content

Added support for bulk/batch requests (atomic:operations) #930

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

Merged
merged 126 commits into from
Feb 10, 2021

Conversation

bart-degreed
Copy link
Contributor

@bart-degreed bart-degreed commented Jan 22, 2021

Introduction

This PR implements the Atomic Operations JSON:API extension, which defines how to perform multiple write operations in a linear and atomic manner.

Clients can send an array of operations in a single request. JsonApiDotNetCore guarantees that those operations will be processed in order and will either completely succeed or fail together.

For more details, see the updated documentation in this PR.

How it works

The request execution pipeline for operations is the following:
RequestDeserializer -> OperationsController (new) -> OperationsProcessor (new) -> ResourceService -> ResourceRepository -> ResponseSerializer

The deserializer and serializer have been updated to understand the new document structure. A new controller type performs ASP.NET ModelState validation on all operations upfront and then delegates to the processor. The processor starts a database transaction and loops over the operations in the list. For each operation, the associated service is called. From there, it follows the usual flow for single-resource requests. After all operations have been processed, the processor commits the transaction.

Fixes #936.
Fixes #247.

Bart Koelman added 30 commits January 20, 2021 13:51
Reverted operations-related changes from #571
…tly enabled when the appropriate controller is added to the project.
…t.IsBulkRequest to EndpointKind.AtomicOperations
Bart Koelman added 15 commits February 4, 2021 18:20
…r)" to investigate why cibuild hangs

This reverts commit d3ff09a.
…yStrings subfolder and auto-adjusted namespaces.
…t, so they can share private models with integration tests for query strings. They are likely to evolve simultaneously, so I prefer not to make a copy of them.

Renamed Blog to LegacyBlog in preparation for refactoring to make query string tests run against private models. LegacyBlog is going away at the end.
…ges:

LegacyBlog -> Blog
	Title -> Title
	CompanyName -> PlatformName
	HasMany Articles -> Posts
	HasOne Owner -> Owner

Article -> BlogPost
	Caption -> Caption
	Url -> Url
	HasOne Author -> Author
	+ HasOne Reviewer
	HasManyThrough Tags -> Labels
	HasMany Revisions -> Comments
	HasOne Blog -> Parent

Tag -> Label
	Name -> Name
	Color -> Color
	HasManyThrough Articles -> Posts

Revision -> Comment
	+ Text
	PublishTime -> CreatedAt
	HasOne Author -> Author
	HasOne Article -> Parent

Author -> WebAccount
	FirstName/LastName -> UserName/DisplayName
	+ Password
	DateOfBirth -> DateOfBirth
	BusinessEmail -> EmailAddress
	LivingAddress -> Preferences
	HasMany Articles -> Posts

Address -> AccountPreferences
	+ UseDarkTheme
@bart-degreed bart-degreed merged commit 6362253 into master Feb 10, 2021
@bart-degreed bart-degreed deleted the atomic-operations branch February 10, 2021 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add support for bulk/batch requests (atomic:operations) Operations: Should be ORM agnostic
2 participants