Open nickevansuk opened 6 years ago
@nickevansuk considering the current state of https://github.com/openactive/opportunity-api/issues/1#issuecomment-406360624, it looks to me as if the only syntax that would be allowable within that grammar is:
sort=subEvent.startDate,asc
sort=location.geo,nearest
sort=offers.price,desc
Something like sort[desc]=offers.price
would be hard to describe for an API specification as the conditional that sort[desc]
and sort[asc]
cannot both be present in the query params. Requiring one and only one use of sort=
, however, is easy to describe in e.g. OpenAPI/Swagger
sort=offers.ext:publicAdultPrice,asc
(see https://github.com/openactive/modelling-opportunity-data/issues/116) would solve the issue of how to sort Events with multiple Offers
Use Case
When returning information relating to sessions or facilities, there are several common sorts:
References
sort=key1:asc,key2:desc,key3:asc
- OpenStacksort_by=-last_modified,+email
- Moesif, Haufe-Lexware, Zalandosort=foo,bar desc
- Google, Microsoft, ODatasort_by=desc(last_modified),asc(email)
- Moesif()
pattern not used elsewheresort=rating,reviews,name&desc=rating,reviews
- Octosort=date_of_birth|asc,zip_code|desc
- PayPal|
character not used elsewhereProposal
As with filtering, the OpenStack approach appears to be the most user-friendly and explicit, as it strikes the best balance between extensibility and familiarity.
Example
sort=location.geo:nearest
sort=startDate:asc
sort=offers.price:asc
(allows the implementation to flex to take intro account multiple offers and multiple currencies)sort=offers.price:desc
(allows the implementation to flex to take intro account multiple offers and multiple currencies)