I am using GraphQL and was wondering, if it is possible to have nested queries so you can have the same query name but within different “context”. For example:
I have 2. Cities, and People.
If I want to query cities instead of getAllCities
and getCityByName
and then getAllPeople
and getPeopleByName
. I’d rather have getAll
and getByName
but have them doing something like cities.getAll
and people.getAll
etc
type CitiesQueries @aws_api_key {
getAll(limit: Int, nextToken: String): Connect
}
type PeopleQueries @aws_api_key {
getAll(limit: Int, nextToken: String): Connect
}
type Query @aws_api_key {
cities: CitiesQueries
people: PeopleQueries
}
Above is an example however I will get an error:
Invalid field name name given, must match pattern [_A-Za-z][_0-9A-Za-z]* (Service: AppSync, Status Code: 400, Request ID:
Seems that field names for AppSync need to match the regex pattern [_A-Za-z][_0-9A-Za-z]*
which disallows the .
so I can’t do something like people.getAll
etc
Any idea how I can achieve what I am looking at?