0no-co / gql.tada

🪄 Magical GraphQL query engine for TypeScript
https://gql-tada.0no.co
MIT License
2.45k stars 36 forks source link

gql.tada doctor/check cannot handle headers in schema object #221

Closed KammererTob closed 3 months ago

KammererTob commented 3 months ago

Describe the bug

gql.tada CLI commands which parse the config containing headers in the schema object fail (examples are doctor and check).

Reproduction:

  1. New Project with those two files. package.json:
    {
    "name": "gql-tada-bug",
    "version": "1.0.0",
    "main": "index.js",
    "license": "MIT",
    "dependencies": {
    "gql.tada": "^1.5.1",
    "typescript": "^5.4.5"
    },
    "devDependencies": {
    "@0no-co/graphqlsp": "^1.10.1"
    }
    }

    tsconfig.json (copied from the documentation):

    {
    "compilerOptions": {
    "plugins": [ 
      {
        "name": "@0no-co/graphqlsp",
        "schema": {
          "url": "http://localhost:4321/graphql",
          "headers": {
            "Accept": "application/graphql-response+json"
          }
        }
      }
    ]
    }
    }
  2. yarn / npm install
  3. gql.tada doctor

Leads to the following error:

⚠ Error The plugin configuration for "@0no-co/graphqlsp" seems to be invalid. ┗ Configuration contains a schema.headers property, but it's not an object

Reproduction

No response

gql.tada version

gql.tada v1.5.1

Validations