FSharp.Data.GraphQL
FSharp.Data.GraphQL copied to clipboard
Filter for root properties
I am having problems to create filter for root property, something like that:
query {
markets (filter : { totalMatched_greater_than : 1000.0 }) {
id
name
totalMatched
status
requestTime
updateTime
selections (filter : { totalMatched_greater_than : 1000.0 }) {
id
name
lastPriceTraded
totalMatched
status
}
}
}
In the code base there is actually no example of such usage. Maybe I am wrong because I just read something about graphQL and trying to implement that in my use case scenario.
@StefanBelo were you able to find a solution?
What happens when you do that?
Does it work for nested fields?
Hi @xperiandri, sorry for replying late.
This is my middlewares definition:
let middlewares = [ Define.ObjectListFilterMiddleware<Root.Root, Label>(true)]
Root.Root is the ObjectType for the QueryRoot. It has a field called labels of type Label list.
When I try to filter in the query as follows:
query { labels (filter: {annotation_sw: "Cu"}) { annotation id } }
It throws the error : "Argument field or value named 'filter' can not be coerced. It does not match a valid literal representation for the type."
Does it work for nested fields?
Yes it does in my case. I tried it for a nested field which is also a list, and it works perfectly.