-
-
Notifications
You must be signed in to change notification settings - Fork 553
Closed
Description
When an operation has a single parameter of type com.querydsl.core.types.Predicate annotated with @QuerydslPredicate, the generated schema does not expose the expected input query param.
Let's say we have the following operation:
@RequestMapping(method = RequestMethod.GET, value = "/operation")
@ResponseBody
public String operation(@QuerydslPredicate(root = MyUser.class) Predicate predicate) {
return "hi";
}
we get something like
"/auth/operation":
{"get":{
"operationId":"operation",
"responses":{"200":{"content":{"*/*":{"schema":{"type":"string"}}}}}
}}
With a additional parameter:
@RequestMapping(method = RequestMethod.GET, value = "/operation")
@ResponseBody
public String operation(@QuerydslPredicate(root = MyUser.class) Predicate predicate, String param) {
return "hi";
}
we get something like
"/auth/operation":
{"get":{
"operationId":"operation",
"parameters":[
{"name":"param","in":"query","required":true,"schema":{"type":"string"}},
{"name":"firstName","in":"query","schema":{"type":"string"}}
],
"responses":{"200":{"content":{"*/*":{"schema":{"type":"string"}}}}}
}}
where firstName is a field of MyUser POJO.
The QuerydslPredicateOperationCustomizer class only customize the operation if parameters are found.
Lines 88 to 91 in c56df04
| public Operation customize(Operation operation, HandlerMethod handlerMethod) { | |
| if (operation.getParameters() == null) { | |
| return operation; | |
| } |
However parameters of type Predicate are ignored
Lines 114 to 120 in 5889678
| QuerydslPredicateOperationCustomizer queryDslQuerydslPredicateOperationCustomizer(Optional<QuerydslBindingsFactory> querydslBindingsFactory) { | |
| if (querydslBindingsFactory.isPresent()) { | |
| getConfig().addRequestWrapperToIgnore(Predicate.class); | |
| return new QuerydslPredicateOperationCustomizer(querydslBindingsFactory.get()); | |
| } | |
| return null; | |
| } |
Metadata
Metadata
Assignees
Labels
No labels