簡體   English   中英

GraphQL 帶有 AWS AppSync 注釋的 Codegen

[英]GraphQL Codegen with AWS AppSync Annotations

我有一個 graphql 架構,其中添加了 AppSync 注釋,例如:

@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.

你知道如何跳過它們嗎?

代碼生成.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

問題是隨機尾隨Ø

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM