This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Support filtering inside a Map #263
Closed
Description
GraphQL does not support the Map type natively: it defines an JSON Object with arbitrary string keys and values of certain type. So avro-schema map type is mapped into a Scalar in our implementation. OTOH, GraphQL allows to pass an argument to any field (including scalars, AFAIU). So we can add an argument(s) that will instruct the library to postprocess a map.
Using the lua-jsonpath library seems to be quite general solution, but it has one disadvantage: we cannot guarantee that a jsonpath expression will not change a shape of a query result. If we change the shape the result will not more fit an original avro-schema. So we need some more specific solution.
We can just list all fields that are need to be shown in a result:
{
my_collection {
my_map(fields: ["foo", "bar"])
}
}