Sandro_V
Sandro_V

Reputation: 560

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

Upvotes: 2

Views: 1492

Answers (1)

Sandro_V
Sandro_V

Reputation: 560

The issue was a random trailing Ø

Upvotes: 1

Related Questions