nessie icon indicating copy to clipboard operation
nessie copied to clipboard

Document CEL application to Nessie filters

Open dimas-b opened this issue 2 years ago • 6 comments

Nessie APIs accept CEL expressions to allow filtering various model objects (e.g. commit log).

However, it proves difficult for end users to construct correct CEL filters even for common use cases.

It would be nice to have a doc page on how to apply CEL expressions to Nessie objects and what data is available to those expressions.

dimas-b avatar Oct 05 '22 16:10 dimas-b

could it make sense to add methods to the builder to generate common filter expressions? or at least override QueryBuilder.filter method to provide javadoc how common cel filters would look like for that particular builder?

for example for GetEntriesBuilder we could document things like size(entry.keyElements) == 4 or entry.encodedKey.startsWith('foo.')

right now a caller has to know about the element name (i.e. entry) and its properties and their structure (i.e. encodedKey being separated by dots)

XN137 avatar Apr 13 '23 10:04 XN137

That would result in a builder-pattern for "all the things CEL", which is maybe a bit too much.

snazy avatar Apr 13 '23 10:04 snazy

Some good/useful examples would be nice though. And links to CEL docs/specs.

snazy avatar Apr 13 '23 10:04 snazy

not "all things CEL" but the suggestion would be to only build context specific things like:

String buildFilterEntryKeyLength(int size) String buildFilterEntryKeyStartsWith(List<String> keyElements)

but this assumes that there are "common filter"-usecases of course the boundaries are fluent between "undiscoverable" and "too specific"

XN137 avatar Apr 13 '23 10:04 XN137

If we add API methods for filters, it might be best to delegate the impl. to the server, which can do it more efficiently.

That said, I do not mean to say that we should add API methods for specific filters.

dimas-b avatar Apr 13 '23 15:04 dimas-b

Prefix-based lookup will be improved by #5591

dimas-b avatar Apr 13 '23 15:04 dimas-b