dotansimha / graphql-code-generator

A tool for generating code based on a GraphQL schema and GraphQL operations (query/mutation/subscription), with flexible support for custom plugins.
https://the-guild.dev/graphql/codegen/
MIT License
10.72k stars 1.31k forks source link

Decorator auto accessors syntax is not supported #9974

Open s-panferov opened 1 month ago

s-panferov commented 1 month ago

Which packages are impacted by your issue?

@graphql-codegen/cli

Describe the bug

The codegen CLI does not seem to be compatible with the accessor syntax:

@observable.ref
accessor data: Workspace;

Output:

✔ Parse Configuration
⚠ Generate outputs
  ❯ Generate to ./gen/
    ✔ Load GraphQL schemas
    ✖ This experimental syntax requires enabling the parser plugin: "decoratorAutoAccessors". (42:11)
    ◼ Generate

Configuration:

import { CodegenConfig } from "@graphql-codegen/cli";

const config: CodegenConfig = {
  schema: "http://localhost:3000/graphql",
  // this assumes that all your source files are in a top-level `src/` directory - you might need to adjust this to your file structure
  documents: [
    "src/**/*.{ts,tsx}",
  ],
  generates: {
    "./gen/": {
      preset: "client",
      plugins: [],
      presetConfig: {
        gqlTagName: "gql",
      },
    },
  },
  // ignoreNoDocuments: true,
};

export default config;

Your Example Website or App

No

Steps to Reproduce the Bug or Issue

No

Expected behavior

Syntax supported

Screenshots or Videos

No response

Platform

"@graphql-codegen/cli": "^5.0.2",

Codegen Config File

No response

Additional context

No response