带有 AWS AppSync 注释的 GraphQL Codegen
我有一个添加了 AppSync 注释的 graphql 架构,例如:
@aws_oidc @aws_api_key
一种类型看起来像这样,例如:
type Response @aws_oidc @aws_api_key {
id: ID!
body: AWSJSON!
status: Int!
header: AWSJSON!
url: String!
createdAt: AWSDateTime!
updatedAt: AWSDateTime!
}
我正在使用 codegen 用于从架构中生成 TypeScript 类型。在我添加注释之前它运行良好。
现在我收到错误消息:
✖ ../app/types/graphql.ts
Failed to load schema from ./stacks/schema.graphql,./appsync.graphql:
Syntax Error: Unexpected character: U+00D8.
GraphQLError: Syntax Error: Unexpected character: U+00D8.
您知道如何跳过它们吗?
Codegen.yml
overwrite: true
schema:
- './stacks/schema.graphql'
- './appsync.graphql'
documents: null
generates:
graphql.ts:
plugins:
- 'typescript'
../app/types/graphql.ts:
plugins:
- 'typescript'
config:
scalars:
AWSJSON: string
AWSDate: string
AWSTime: string
AWSDateTime: string
AWSTimestamp: number
AWSEmail: string
AWSURL: string
AWSPhone: string
AWSIPAddress: string
Queue: string
appsync.graphql
scalar AWSDate
scalar AWSTime
scalar AWSDateTime
scalar AWSTimestamp
scalar AWSEmail
scalar AWSJSON
scalar AWSURL
scalar AWSPhone
scalar AWSIPAddress
I've got a graphql schema with added AppSync annotations like:
@aws_oidc @aws_api_key
One type looks like that for example:
type Response @aws_oidc @aws_api_key {
id: ID!
body: AWSJSON!
status: Int!
header: AWSJSON!
url: String!
createdAt: AWSDateTime!
updatedAt: AWSDateTime!
}
I am using codegen for generating TypeScript types out of the schema. It worked well till I've added the annotations.
Now I get the error message:
✖ ../app/types/graphql.ts
Failed to load schema from ./stacks/schema.graphql,./appsync.graphql:
Syntax Error: Unexpected character: U+00D8.
GraphQLError: Syntax Error: Unexpected character: U+00D8.
Do you have any idea on how to skip them?
Codegen.yml
overwrite: true
schema:
- './stacks/schema.graphql'
- './appsync.graphql'
documents: null
generates:
graphql.ts:
plugins:
- 'typescript'
../app/types/graphql.ts:
plugins:
- 'typescript'
config:
scalars:
AWSJSON: string
AWSDate: string
AWSTime: string
AWSDateTime: string
AWSTimestamp: number
AWSEmail: string
AWSURL: string
AWSPhone: string
AWSIPAddress: string
Queue: string
appsync.graphql
scalar AWSDate
scalar AWSTime
scalar AWSDateTime
scalar AWSTimestamp
scalar AWSEmail
scalar AWSJSON
scalar AWSURL
scalar AWSPhone
scalar AWSIPAddress
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是随机尾随
Ø
The issue was a random trailing
Ø