简体   繁体   中英

GraphQL Codegen with AWS AppSync Annotations

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

The issue was a random trailing Ø

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM