Skip to content
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

Unable to sort using JSONAPI "?sort=somefield" #160

Open
sblosser opened this issue Oct 4, 2016 · 1 comment
Open

Unable to sort using JSONAPI "?sort=somefield" #160

sblosser opened this issue Oct 4, 2016 · 1 comment

Comments

@sblosser
Copy link

sblosser commented Oct 4, 2016

I'm using EmberJS/Ember Data 2.8.0 to talk to a loopback 2.22.0 server using loopback-component-jsonapi 1.1.0 backed by a MariaDB database.

When I send the GET request http://localhost:3000/api/shipments?sort=-timestamp the results should be sorted descending by timestamp, however they are not. If I send the GET request http://localhost:3000/api/shipments?filter%5Border%5D=timestamp%20DESC I do get the result sorted descending by timestamp. (That is ...shipments?filter[order]=timestamp DESC urldecoded.)The first format is specified in the JSONAPI spec. The later is the "loopback" way of passing an order filter.

I turned on debugging and I can see that, when the "?sort=" method is used, the "ORDER BY" clause never makes it to the SQL server, so it must not be making it through loopback-component-jsonapi. I'm working around it by manipulating the query string in Ember, but I thought I'd report the bug in case anyone else ran into it or knew how to fix it. :)

@digitalsadhu
Copy link
Owner

Thanks for reporting. Yup, this is a yet to be implemented. This and other features such as correct includes syntax are essentially syntax mappings to loopback syntax. Theres still a tonne of small polish type items like this that it would be great to get done. Ah to have more time :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants