Support filtering inside a Map
Totktonada opened this issue · comments
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"])
}
}
From the other side, aliases already breaks this property: the result is not more guaranteed to match an original avro-schema. Maybe shape of a result should be more or less up to a user. So we can consider jsonpath if it allows to filter inner fields w/o moving then on the upper level. But it seems it don't.
From the other side, aliases already breaks this property: the result is not more guaranteed to match an original avro-schema.
This can be fixed, filed #269 for this.
I'm going to archive the repository. I'll proceed as follows:
- Mark all open pull requests with the
archived
label and close. - Mark all open issues with
archived
andwontfix
labels and close. - Archive the repository.
Consider the following projects: