openactive-archive / opportunity-api

Repository for the Opportunity API specification
0 stars 0 forks source link

Sorting #4

Open nickevansuk opened 6 years ago

nickevansuk commented 6 years ago

Use Case

When returning information relating to sessions or facilities, there are several common sorts:

References

Proposal

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

lukehesluke commented 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:

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

nickevansuk commented 6 years ago

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