Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[aws-appsync] code-first implementation of query definition #9308

Closed
BryanPan342 opened this issue Jul 28, 2020 · 0 comments · Fixed by #9992
Closed

[aws-appsync] code-first implementation of query definition #9308

BryanPan342 opened this issue Jul 28, 2020 · 0 comments · Fixed by #9992
Assignees
Labels
@aws-cdk/aws-appsync Related to AWS AppSync effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on. p2

Comments

@BryanPan342
Copy link
Contributor

BryanPan342 commented Jul 28, 2020

Allow query definition for schema.

Use Case

Would allow for definition of query type fields alongside resolvers for a code-first approach.

Proposed Solution

const api = new GraphQLApi(stack, 'ExampleApi', {
  name: 'example',
  schemaDefinition: SCHEMA.CODE,
  ...
}

const example = api.addType('Example', {
  definition: {
    ScalarType.int('id').required(),
    ScalarType.string('content').required(), 
  },
  authorization: AUTH.AWS_IAM,
});

api.addQuery( 'getExamples', {
  type: ScalarType.list.custom(example),
  resolve: [{
    dataSource: exampleDS,
    request: MappingTemplate.dynamoDbScanTable(),
    response: MappingTemplate.dynamoDbResultList(),
  }],
});

Query is defined through a code-first approach and resolvers are mapped inline.

Other

Tracked by: #9305


This is a 🚀 Feature Request

@BryanPan342 BryanPan342 added p2 feature-request A feature should be added or improved. effort/medium Medium work item – several days of effort needs-triage This issue or PR still needs to be triaged. labels Jul 28, 2020
@BryanPan342 BryanPan342 self-assigned this Jul 28, 2020
@github-actions github-actions bot added the @aws-cdk/aws-appsync Related to AWS AppSync label Jul 28, 2020
@BryanPan342 BryanPan342 removed the needs-triage This issue or PR still needs to be triaged. label Jul 28, 2020
@BryanPan342 BryanPan342 added the in-progress This issue is being actively worked on. label Aug 27, 2020
@mergify mergify bot closed this as completed in #9992 Aug 29, 2020
mergify bot pushed a commit that referenced this issue Aug 29, 2020
…roach (#9992)

Implemented methods in `appsync.Schema` to easily generate query/mutation fields, or bind an existing `ObjectType` as the top level query/mutation type.

Fixes: #9308 
Fixes: #9310 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-appsync Related to AWS AppSync effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants