Skip to content

Apply a multiple values argument to the same property in Querydsl #281

Closed
@Map

Description

@Map

Hello everyone and thanks for the amazing work! I am new to Querydsl, Graphql and submitting issues on gh. Maybe I just didn't figure out the right approach or use the wrong tools. Anyway, here is the issue:
I want my Resultset to match a valuelist given as argument(s) for a QuerydslDatafetcher, e.g.: find all purchaseorders with id in id:[1,2]

Changing the schema to accept id:[ID] will fail with an exception (cannot cast List to String) and of course, repeating arguments in the arguments map is not allowed.

querydsl allows multiple values for the same property in the querystring, e.g. /purchaseorders?id=1&id=2 and also customizing bindings by using the bindings.all() method in QuerydslBinderCustomizer:
bindings.bind(QPurchaseorder.purchaseorder.id).all((path, value) -> Optional.of(path.in(value)));
My current workaround: I pass another argument ids:String that is not part of the Q entity and bind the parsed ids via all() method to the purchaseorder.id path. The problem now: if the id argument is not part of the graphqlquery, that databinding will never happen and I end up having a dummyparameter like this
findPurchaseOrders(id:0, ids:"1,2") { ...

Is here a nicer workaround? Or a potential feature? Or a false hope to have an omnipotent graphql-to-sql translator?

Metadata

Metadata

Assignees

Labels

in: dataIssues related to working with datatype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions