- Mais recentes
- Mais votos
- Mais comentários
AWS AppSync does not currently provide a way to map queries/mutations/fields to a resolver without having to define everything as a 1:1 mapping. Each resolver must be explicitly defined in the schema.
However, you can simplify your CloudFormation template by using CloudFormation macros to generate the resolver mappings for you. This can help reduce the amount of boilerplate code and make the template more manageable.
Alternatively, you can use AWS Amplify to generate the schema and resolver mappings for you based on your backend logic. Amplify provides a CLI that can introspect your backend code and generate a GraphQL schema and resolvers automatically. This can save a significant amount of time and reduce the need for manual updates to the schema and resolver mappings.
Overall, while there is no default or pattern-based resolver mapping feature in AWS AppSync, there are tools available to help simplify the management of resolver mappings.
Conteúdo relevante
- AWS OFICIALAtualizada há 2 anos
Do you know if the AWS AppSync team has any plans to support this? It'd be a great feature.
The suggestion of reducing boilerplate with CloudFormation macros helps, but doesn't solve the problem of infrastructure growing as the GraphQL API expands. Eventually, deploying a small update to a single Lambda function could require updating hundreds of AppSync resolvers depending on it. This is not a problem with API Gateway, a similar product.
One suggestion: update the CreateResolver API [1] to support wildcard patterns in the
typeName
andfieldName
inputs.Example 1: Attach a resolver to all mutations
Example 2: Attach a resolver to all matching pattern Query.user*
[1] https://docs.aws.amazon.com/appsync/latest/APIReference/API_CreateResolver.html