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

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

Merged
merged 47 commits into from
Aug 15, 2020

Conversation

BryanPan342
Copy link
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
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
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
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
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
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
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
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
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
Contributor Author

@Mergifyio refresh

@mergify
Copy link
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