Skip to content

Doesn't resolve schema url from env parameters #19

@brycefranzen

Description

@brycefranzen

The following file works for codegen using the following command:

DOTENV_CONFIG_PATH=.env graphql-codegen  -r dotenv/config

However, the graphql lsp doesn't get the url from process.env.GQL_URL resulting in the schema not being found and no lsp suggestions.

If I provide a deafault schema in the empty quotes, then the lsp registers correctly and provides suggestions accordingly.

Please provide a configuration parameter for .env file path, or a project-level config parameter where I can set the graphql schema url.

// graphql.config.ts
import type { IGraphQLConfig } from "graphql-config";

const config: IGraphQLConfig = {
  schema: process.env.GQL_URL || "",
  documents: ["./graphql/**/*.gql", "./app/**/*.gql"],
  extensions: {
    codegen: {
      overwrite: true,
      ignoreNoDocuments: true,
      config: {
        typesPrefix: "T",
        scalars: {
          DateTime: "string",
          ID: "string",
        },
      },
      generates: {
        "graphql/generated/types.ts": {
          plugins: [
            "typescript",
            "typescript-operations",
            "typescript-react-apollo",
          ],
          config: {
            withHooks: false,
            addDocBlocks: false,
            skipTypename: false,
            withResultType: false,
          },
        },
      },
      hooks: {
        afterAllFileWrite: ["prettier --write"],
      },
    },
  },
};

export default config;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions