Comments (4)
I made more tests and it seems that ordering is always the same for same inputs, but differs for other strings, but ordering is not alphabetically.
I also found out that there is no difference in the output when inserting strings at a different position (other index in path), so either index in path is ignored completely or some sorting is applied afterwards.
from base-repo.
While this issue has impact in base-repo, it actually relates to kit-data-manager/service-base and src/main/java/edu/kit/datamanager/util/PatchUtil.java. However, also there only a third party library is used where it comes to the following line of code at the end: https://github.com/java-json-tools/json-patch/blob/55b27b96045baa4ef356b2b183304551f64a18e4/src/main/java/com/github/fge/jsonpatch/AddOperation.java#L130
As one can see, the index is properly evaluated and the new element should be added at the correct position, but there is a "but". Afterwards, the modified resource is written to the basebase and what you see as an "array" is actually represented as Set of strings, which has no index/primary key that can be utilized for sorting as it is the case for sets of complex objects. For strings, only uniqueness of entries, but no specific order is guaranteed from the database side. This indeed leads to unpredictable behaviour in terms of ordering, but I'm afraid it is working as intended. ;-)
from base-repo.
Indeed, it's also not possible to add the same value twice (never tried that before), which also points to a set rather than an array.
Of course I would prefer that the order is retained and arrays behave like arrays (there are no sets in JSON specification) and JSON-Patch works like it should according to specification, but this would probably be more work than just adding an additional order/index column to the database - but it would also make repo more versatile.
So at least it should be clearly communicated everywhere in the documentation where these "set-arrays" occur, I used this documentation to dive into this topic and would suggest that you add a prominent notice at the top of the page.
from base-repo.
Thanks for the pointer, I've added a note.
from base-repo.
Related Issues (20)
- If versioning is not enabled locationUri shouldn't contain version. HOT 2
- Listing DataResource Content Information HOT 1
- weak search performance under certain conditions HOT 1
- Security issues with com.h2database/[email protected]
- Configuration for branch_on_issue action is missing. HOT 1
- Datacite input not working HOT 1
- Mediatype detection issue not solved HOT 1
- Codecov badge is broken HOT 1
- Bump CodeQL from v1 to v2. HOT 2
- Improper dealing with escaped slashes in request URL HOT 1
- Creator can be deleted when reuse it's ID HOT 2
- OpenAPI documentation misleading/incomplete HOT 1
- Add ro-crate support for exporting (and importing?) Data Resources HOT 1
- ElasticConfiguration missing in 1.5.0 Release HOT 1
- Properties validation not working HOT 1
- Elastic search proxy at /api/v1/search not working HOT 1
- fileVersion seems to be based on version HOT 3
- Swagger not accessible HOT 1
- Search for state REVOKED returns VOLATILE and FIXED HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from base-repo.