Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to implement atomic operations#995

SafaAlfulaij started this conversation inGeneral
Oct 17, 2021· 6 comments· 6 replies
Discussion options

The new JSON:API spec has added Atomic Operations:https://jsonapi.org/ext/atomic/
This is to discuss how could this be implemented in a salable and DRY way.

Edit:
@jokiefer has started working on a librarydrf-json-api-atomic-operations, and we encourage anyone who needs atomic operation support to join his effort implementing it.

You must be logged in to vote

Replies: 6 comments 6 replies

Comment options

thats for version 1.1 of the spec which this package do not support yet.

You must be logged in to vote
0 replies
Comment options

Yes, I am aware.
Eventually it should support. That's why I opened this here in discussions.

You must be logged in to vote
3 replies
@sliverc
Comment options

@SafaAlfulaij Thanks for starting this discussion. As stated those extensions are a draft and to quote from the page "describes features from an upcoming version of the of the JSON:API specification and is subject to change without notice."

This needs to be kept in mind when discussing this. My initial thought is that implementation of such a feature might actually be best done or experimented with in an external library. When matured it can still be considered to be added to this library. But even if we consider developing such a feature within DJA itself it is important that it is a separate optional feature (not like the current polymorphic support which can not easily be separated from the main of the code). This will most likely mean to improve the API of the general DJA classes. This will be more work but eventually will be a win for all DJA users as well.

@auvipy
Comment options

As per the recent comment of the json-api team. the core and specs are alreasy fixed. they are now waiting for reference implementations to tweaks any edge cases. those are very minor issues. so 3rd part proof o concept extensons can be developed and pull requests created for review. since the both spec versions will be backward compatible. having a new implementation would be great before merging intro here.

@SafaAlfulaij
Comment options

Fair enough.
I guess that I'll experiment and see how it goes.

Some points that I'll put here for future:

  • DB transaction
  • Performance optimization
    1‌. Batched creating/editing/deleting DB operations
    2‌. Batched relationships querying (validation)
Comment options

The new JSON:API spec has added Atomic Operations:https://jsonapi.org/ext/atomic/ This is to discuss how could this be implemented in a salable and DRY way.

also before implementing an exension, we need to implement the baseline core features of v 1.1 rc3+ :D

You must be logged in to vote
2 replies
@codyfazio
Comment options

Curious where things stand on both v1.1 support (having trouble finding in the docs) and potential for atomic extension support?

@sliverc
Comment options

JSON:API v1.1 is now final. Our progress in implementing it can be found in thisdiscussion.

As atomic operation is an extension to JSON:API spec, I think it makes most sense to implement support for it in a 3rdParty library and in DJA we focus on getting the new v1.1 standard implemented. If anyone wants to pick this up and create a library, that would be great. If a library is well established, it can always be considered again to re-integrate it into DJA. See also myreply.

Comment options

Since this is not yet available in this library I made my own sketch in Flask before implementing it myself in my Django project. Maybe it helps someone:https://github.com/Nekidev/jsonapi-atomic

You must be logged in to vote
0 replies
Comment options

Here is a first alpha version for anatomic operations extension. Helpfull if someone could contribute. 🙏

You must be logged in to vote
0 replies
Comment options

Any update on this? Will official support be added to this project? Or should we plan on using jokiefer's extension?

You must be logged in to vote
1 reply
@sliverc
Comment options

Thanks for following up on this. As stated in my commenthere we highly encourage implementing atomic operations in a 3rd party library as it is also an extension to JSON:API spec as such. Thanks@jokiefer that you started to work on this and@avelosa it would be great if you could join his effort by using and testingdrf-json-api-atomic-operations. Once it is in a usable state feel free to open a PR to add the library to our list of3rd party libraries.

I will also update the initial description of this discussion, so it is clear for people what the decision is when they stumble upon it.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
General
Labels
None yet
7 participants
@SafaAlfulaij@sliverc@avelosa@auvipy@codyfazio@jokiefer@Nekidev

[8]ページ先頭

©2009-2025 Movatter.jp