Schema Definition with custom scalars from AWS Amplify #4311
-
I'm trying to generate Typescript typings from some schema files used with AWS Amplify. An example type is like this: type Record {
id: ID
createdBy: ID
created: AWSTimestamp
modified: AWSTimestamp
} I have tried setting my config.yml as follows: overwrite: true
schema: "amplify/backend/api/blockgraph/schema/*.graphql"
generates:
src/generated/graphql.ts:
config:
scalars:
AWSTimestamp: string
plugins:
- "typescript" Trying to run the codegen, I get the error, If I add |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 11 replies
-
I see Amplify has this file, https://github.com/aws-amplify/amplify-cli/blob/master/packages/amplify-codegen/awsAppSyncDirectives.graphql, so I guess if I 'imported' that, it would include those definitions. Seems like this should be done in the 'documents' part of the config. However, this is a globally installed node_module so not certain how to reference it. Edit - seems to work by including the file as an extra |
Beta Was this translation helpful? Give feedback.
-
How to achieve same with codegen.ts |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I had similar issues generating the Amplify C# code. I've added a gist here for anyone generating those https://gist.github.com/deeja/50ff900a0780ba8c5afa0785e008be0f |
Beta Was this translation helpful? Give feedback.
I see Amplify has this file, https://github.com/aws-amplify/amplify-cli/blob/master/packages/amplify-codegen/awsAppSyncDirectives.graphql, so I guess if I 'imported' that, it would include those definitions. Seems like this should be done in the 'documents' part of the config. However, this is a globally installed node_module so not certain how to reference it.
Edit - seems to work by including the file as an extra
schema
file