Closed Dennis-Nilsson closed 1 year ago
You should simply do:
?filter=exists(stakeholders.roles : 'ADMIN')
That query results in this exception unfortunately:
com.turkraft.springfilter.exception.InternalFilterException: The input 'ADMIN' could not be converted to interface java.util.List
at com.turkraft.springfilter.parser.generator.expression.ExpressionGenerator.visitInput(ExpressionGenerator.java:482)
at com.turkraft.springfilter.parser.generator.expression.ExpressionGenerator.visitInput(ExpressionGenerator.java:44)
at com.turkraft.springfilter.parser.FilterParser$InputContext.accept(FilterParser.java:158)
at com.turkraft.springfilter.shaded.org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
at com.turkraft.springfilter.parser.generator.expression.ExpressionGenerator.visitComparison(ExpressionGenerator.java:200)
at com.turkraft.springfilter.parser.generator.expression.ExpressionGenerator.visitInfix(ExpressionGenerator.java:172)
at com.turkraft.springfilter.parser.generator.expression.ExpressionGenerator.visitInfix(ExpressionGenerator.java:44)
at com.turkraft.springfilter.parser.FilterParser$InfixContext.accept(FilterParser.java:263)
at com.turkraft.springfilter.shaded.org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
at com.turkraft.springfilter.parser.generator.expression.ExpressionGenerator.run(ExpressionGenerator.java:53)
at com.turkraft.springfilter.parser.generator.expression.ExpressionGenerator.run(ExpressionGenerator.java:58)
at com.turkraft.springfilter.parser.generator.expression.ExpressionGenerator.getSubquery(ExpressionGenerator.java:449)
at com.turkraft.springfilter.parser.generator.expression.ExpressionGenerator.visitFunction(ExpressionGenerator.java:401)
at com.turkraft.springfilter.parser.generator.expression.ExpressionGenerator.visitFunction(ExpressionGenerator.java:44)
at com.turkraft.springfilter.parser.FilterParser$FunctionContext.accept(FilterParser.java:214)
at com.turkraft.springfilter.shaded.org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
at com.turkraft.springfilter.parser.generator.expression.ExpressionGenerator.visitFilter(ExpressionGenerator.java:109)
at com.turkraft.springfilter.parser.generator.expression.ExpressionGenerator.visitFilter(ExpressionGenerator.java:44)
at com.turkraft.springfilter.parser.FilterParser$FilterContext.accept(FilterParser.java:111)
at com.turkraft.springfilter.shaded.org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
at com.turkraft.springfilter.parser.generator.expression.ExpressionGenerator.run(ExpressionGenerator.java:53)
at com.turkraft.springfilter.boot.FilterSpecification.toPredicate(FilterSpecification.java:62)
Hi @Dennis-Nilsson
This is fixed in version 3.0.0. You should be able to query 'admin' in stakeholders.roles
.
Hello!
Is it possible to filter a List-field with a "contains"-function?
If I got a field with datatype List and I want to filter with something like this:
?filter=stakeholders.roles contains 'ADMIN'
I can't find anything about this in the documentation.