self-xdsd / self-core

Self's core, implemented with Java SE 11.
https://self-xdsd.com
Other
28 stars 12 forks source link

CachedResource: Uniform URI keys. #1180

Open criske opened 3 years ago

criske commented 3 years ago

Having two URI's

/foo/bar?a=100&b=true and /foo/bar?b=true&a=100

Eventhough these URIs have query parameters in different order, they are pointing to the same Resource. And this will lead to duplicate entries in JsonStorage - will be treated as different primary key.

Proposal: order URI query parameters by 'name' in alphabetical oder before storing CachedResource into JsonStorage.

Ex: /foo/bar?b=true&a=100 will be /foo/bar?a=100&b=true before storing.

zoeself commented 3 years ago

@criske thank you for reporting this. I'll assign someone to take care of it soon.

criske commented 3 years ago

@amihaiemil now that I think about it, I think this should be done by JsonStorage implementation - both before storing and getting:

For example if we query for Json#getResource(/foo/bar?b=true&a=100), it should order internally and then query for resource..

Edit -- or in JsonResources, just to keep the logic in self-core. :D

zoeself commented 3 years ago

@amihaiemil I couldn't find any assignee for this task. This is either because there are no contributors with role DEV available or because the project does not have enough funds.

Please, make sure there is at least one available contributor with the required role and the project can afford to pay them.

amihaiemil commented 3 years ago

@criske It's a valid issue, but as you said in Prod we will never face it. Github and GitLab URIs do not use query parameters at all (maybe just per_page). So I think it's virtually a useless fix: more complicated code for nothing : D

zoeself commented 2 years ago

@amihaiemil I couldn't find any assignee for this task. This is either because there are no contributors with role DEV available or because the project does not have enough funds.

Please, make sure there is at least one available contributor with the required role and the project can afford to pay them.