Re: Filters as views (ISSUE-45)

Hi Asbjørn

>> I've just implemented this approach in my URSA - it's a simple
>> query string property that can be fed with an extensive filtering
>> expression.
>That's very interesting. Would you care to provide an example of how
>an IRI template for OData could look like so we can discuss the
>details of it a bit more concretely?

Implementation is quite simple. Server builds a complete API documentation 
based on reflection and other pieces of information (C#). Resulting Iri 
template would look like this:
http://my.api/entry-point/products{?$filter,$skip,$top}
Variable mapping uses a fake OData namespace (as there is none suitable for 
now): http://docs.oasis-open.org/odata/odata/v4.0/$filter. I could use 
http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part2-url-conventions/odata-v4.0-errata02-os-part2-url-conventions-complete.html#_Toc406398094 
as the reference, which is actual one leading to $filter description, but it 
looks ugly.

Client side have several components which are checked against each mapping 
and if it responds positively it is allowed to process passed information 
(current filter settings, paging, etc.) and generates an expression. This 
way I can have several components which may "understand" various mappings. 
If no components is applicable, it is just left untouched. Iri template 
allows the value to be optional, thus it will miss that very variable value.

As for the expression is created depending on data types of property filters 
(i.e. various versions for dates, i.e. eq for full date/time and ge/le for 
dates, indexOf for string, etc.)

I'll try to update the client demo to the latest codes, but I started 
fooling around with it and I need some time to have it up and working back 
again.

Regards

Karol 

Received on Monday, 22 February 2016 19:01:09 UTC