[aws-appsync] Code first object type implementation of multiple interfaces generates invalid graphql output
See original GitHub issueUsing the code-first strategy: when an ObjectType
implements several InterfaceType
, the generated schema produces a syntax error since the interfaces are appended via ,
instead of &
.
Reproduction Steps
Given the following code:
const myInterface1 = new InterfaceType('MyInterface1', {
definition: {
// ...
}
});
const myInterface2 = new InterfaceType('MyInterface2', {
definition: {
// ...
}
});
const myObjectType = new ObjectType('MyObjectType', {
interfaceTypes: [myInterface1, myInterface2],
// ...
});
What did you expect to happen?
Output should be
interface MyInterface1 {
# ...
}
interface MyInterface2 {
# ...
}
type MyObjectType implements MyInterface1 & MyInterface2 {
# ...
}
What actually happened?
Instead the code outputs the following, which is invalid graphql code:
interface MyInterface1 {
# ...
}
interface MyInterface2 {
# ...
}
type MyObjectType implements MyInterface1, MyInterface2 {
# ...
}
Environment
- CLI Version :
- Framework Version: 1.63.0
- Node.js Version:
- OS :
- Language (Version):
Other
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Interfaces and unions in GraphQL - AWS AppSync
The GraphQL type system supports Interfaces . An interface exposes a certain set of fields that a type must include to implement the...
Read more >Are array types incorrect when generating React/Apollo hooks ...
I am wondering if arrays defined in graphql queries ...
Read more >GraphQL Code Libraries, Tools and Services
A plugin based schema builder for creating code-first GraphQL schemas in ... Type-safe response objects: genqlient generates the right type for each query, ......
Read more >Interface Type - Hot Chocolate v10
A single object can implement multiple interfaces and is not limited to just one. An interface in GraphQL consists of a collection of...
Read more >Serverless GraphQL using with AWS and ent
For the present tutorial, we type "Todo", see the screenshot below, and click the "Create" button. Screenshot of creating a new AWS AppSync...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@BryanPan342 So far it has helped me a lot writing my (rather complex) GraphQL schema in a more modular and clear way. The only thing I am missing is the final schema output somewhere in my project, is there a straightforward way to do this? Good work!
@chargome glad to hear you have been having a good experience so far 😊
check out this sample app i made!
It’s not complete with functional resolvers at the moment, but I added a bit of code to
cdk-app.ts
to spit out the generated schema 😃https://github.com/BryanPan342/starwars-code-first/blob/master/bin/starwars-code-first.ts#L7-L20