Skip to content

feat(appsync): code-first schema allows for object type definition#9417

Merged
mergify[bot] merged 47 commits intoaws:masterfrom
BryanPan342:shema
Aug 15, 2020
Merged

feat(appsync): code-first schema allows for object type definition#9417
mergify[bot] merged 47 commits intoaws:masterfrom
BryanPan342:shema

Conversation

@BryanPan342
Copy link
Copy Markdown
Contributor

@BryanPan342 BryanPan342 commented Aug 3, 2020

AppSync now able to generate a code-first approach to generating object and interface types through code. You can also append to schema through the GraphQLApi.appendToSchema function.

Feature List:

  • GraphqlTypes
  • InterfaceTypes
  • ObjectTypes
  • Directives

All details can be found in the README.md

Fixes #9307


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@BryanPan342 BryanPan342 added the @aws-cdk/aws-appsync Related to AWS AppSync label Aug 3, 2020
@BryanPan342 BryanPan342 self-assigned this Aug 3, 2020
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Aug 3, 2020
@BryanPan342
Copy link
Copy Markdown
Contributor Author

BryanPan342 commented Aug 3, 2020

[TODO]

  • make unit tests for each use case
  • round off integ test
  • double check implementation
  • flesh out README
  • remove fs.writeFile (just used for easy testing)
    writeFile('generated.graphql', this.schema.definition, (err) => {
    if (err) {
    throw new Error(err.message);
    }
    });

@BryanPan342 BryanPan342 marked this pull request as draft August 10, 2020 17:37
@BryanPan342 BryanPan342 marked this pull request as ready for review August 10, 2020 22:08

```ts
import * as appsync from '@aws-cdk/aws-appsync';
import * as db from '@aws-cdk/aws-dynamodb';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import * as db from '@aws-cdk/aws-dynamodb';
import * as ddb from '@aws-cdk/aws-dynamodb';

},
});

const demoTable = new db.Table(stack, 'DemoTable', {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const demoTable = new db.Table(stack, 'DemoTable', {
const demoTable = new ddb.Table(stack, 'DemoTable', {

const demoTable = new db.Table(stack, 'DemoTable', {
partitionKey: {
name: 'id',
type: db.AttributeType.STRING,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type: db.AttributeType.STRING,
type: ddb.AttributeType.STRING,

const api = new appsync.GraphQLApi(stack, 'Api', {
name: 'demo',
schemaDefinition: appsync.SchemaDefinition.FILE,
schemaDefinitionFile: join(__dirname, 'schema.graphql'),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might want to provide an example that includes that this file contains

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Aug 15, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Aug 15, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 1da6d11
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@BryanPan342
Copy link
Copy Markdown
Contributor Author

@Mergifyio refresh

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Aug 15, 2020

Command refresh: success

@mergify mergify bot merged commit 6f1782f into aws:master Aug 15, 2020
@BryanPan342 BryanPan342 deleted the shema branch September 8, 2020 18:33
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 contribution/core This is a PR that came from AWS.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[aws-appsync] code-first generation of object types for schema

3 participants