Basically the title of the issue, but i will give a brief explaination.
I have a controller with an end-point:
@Fields
@GetMapping
@PreAuthorize("hasAuthority('employees:view')")
public Page<UserDto> findAll(@Filter(parameter = "q") FilterSpecification<User> filter, @com.turkraft.springfilter.boot.Page Pageable pageable) {
return entityService.findAll(filter, pageable).map(userMapper::toDto);
}
There are two major problems:
- Since i'm using the jpa Page, the result i in the
content node of the response, so i need to pass content.name if i only want the name of the users
- The pagination and sorting params are not returned in the response
Here a screenshot of Postman without the fields paramether and as tou can see all the sorgint and paging parameters are returned:
Here a screenshot of Postman with the same request and the fields parameter passed to the request:
As you can see, i need to pass content.* and also the sorting and pating parameters are not present in the response.
Also as a side note, if i try to filter with a "in" -> name in ('Matteo','Tommaso') as shown in the swagger auto implementation of this library:
The filter does not get recognized and i receive an error:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: com.turkraft.springfilter.parser.InvalidSyntaxException: mismatched input ',' expecting {<EOF>, INFIX_OPERATOR, POSTFIX_OPERATOR}] with root cause
com.turkraft.springfilter.parser.InvalidSyntaxException: mismatched input ',' expecting {<EOF>, INFIX_OPERATOR, POSTFIX_OPERATOR}
at com.turkraft.springfilter.parser.ThrowingErrorListener.syntaxError(ThrowingErrorListener.java:16)
at com.turkraft.springfilter.shaded.org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41)
at com.turkraft.springfilter.shaded.org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:544)
at com.turkraft.springfilter.shaded.org.antlr.v4.runtime.DefaultErrorStrategy.reportInputMismatch(DefaultErrorStrategy.java:327)
at com.turkraft.springfilter.shaded.org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:139)
at com.turkraft.springfilter.parser.AntlrFilterParser.filter(AntlrFilterParser.java:154)
at com.turkraft.springfilter.parser.FilterParserImpl.parse(FilterParserImpl.java:38)
at com.turkraft.springfilter.converter.FilterStringConverterImpl.convert(FilterStringConverterImpl.java:44)
at com.turkraft.springfilter.converter.FilterStringConverter.convert(FilterStringConverter.java:13)
Basically the title of the issue, but i will give a brief explaination.
I have a controller with an end-point:
There are two major problems:
contentnode of the response, so i need to passcontent.nameif i only want the name of the usersHere a screenshot of Postman without the fields paramether and as tou can see all the sorgint and paging parameters are returned:
Here a screenshot of Postman with the same request and the fields parameter passed to the request:
As you can see, i need to pass content.* and also the sorting and pating parameters are not present in the response.
Also as a side note, if i try to filter with a "in" ->
name in ('Matteo','Tommaso')as shown in the swagger auto implementation of this library:The filter does not get recognized and i receive an error: