Skip to content

Commit

Permalink
fix(appsync): multiple interface types generates invalid schema (#10481)
Browse files Browse the repository at this point in the history
Make the GraphQL Schema construct multiple interface implementation in the following manner:

```gql
type Object implements Interface1 & interface2 {
  ...
}
```

Fixes #10479

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
BryanPan342 authored Sep 30, 2020
1 parent 3a1d38e commit 6f2d393
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-appsync/lib/private.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function concatAndDedup<T>(left: T[], right: T[]): T[] {
function generateInterfaces(interfaceTypes?: InterfaceType[]): string {
if (!interfaceTypes || interfaceTypes.length === 0) return '';
return interfaceTypes.reduce((acc, interfaceType) =>
`${acc} ${interfaceType.name},`, ' implements').slice(0, -1);
`${acc} ${interfaceType.name} &`, ' implements').slice(0, -2);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('testing Object Type properties', () => {
api.addType(objectTest);

const gql_interface = 'interface baseTest {\n id: ID\n}\ninterface anotherTest {\n id2: ID\n}\n';
const gql_object = 'type objectTest implements anotherTest, baseTest {\n id3: ID\n id2: ID\n id: ID\n}\n';
const gql_object = 'type objectTest implements anotherTest & baseTest {\n id3: ID\n id2: ID\n id: ID\n}\n';
const out = `${gql_interface}${gql_object}`;

// THEN
Expand Down

0 comments on commit 6f2d393

Please sign in to comment.