Skip to content

Field args marked as @deprecated are lost when getting schema over HTTP #9659

Open
@mikew

Description

@mikew

Which packages are impacted by your issue?

No response

Describe the bug

Given a schema like

type Query {
    example(arg: ID @deprecated): ID
}

type Foo {
    example(arg: ID @deprecated): ID
}

The args for the various fields that are marked as @deprecated are lost in all files generated by graphql-code-generator.

schema-ast produces:

type Foo {
  example: ID
}

type Query {
  example: ID
}

introspection produces:

      {
        "kind": "OBJECT",
        "name": "Foo",
        "description": null,
        "fields": [
          {
            "name": "example",
            "description": null,
            "args": [],
            "type": {
              "kind": "SCALAR",
              "name": "ID",
              "ofType": null
            },
            "isDeprecated": false,
            "deprecationReason": null
          }
        ],
        "inputFields": null,
        "interfaces": [],
        "enumValues": null,
        "possibleTypes": null
      },
      {
        "kind": "OBJECT",
        "name": "Query",
        "description": null,
        "fields": [
          {
            "name": "example",
            "description": null,
            "args": [],
            "type": {
              "kind": "SCALAR",
              "name": "ID",
              "ofType": null
            },
            "isDeprecated": false,
            "deprecationReason": null
          }
        ],
        "inputFields": null,
        "interfaces": [],
        "enumValues": null,
        "possibleTypes": null
      },

typescript generates

export type Foo = {
  __typename?: 'Foo';
  example?: Maybe<Scalars['ID']['output']>;
};

export type Query = {
  __typename?: 'Query';
  example?: Maybe<Scalars['ID']['output']>;
};

Your Example Website or App

https://stackblitz.com/edit/github-t8cgka

Steps to Reproduce the Bug or Issue

Visit the stackblitz reproduction and wait a few seconds for the server to start and graphql-code-generator to run

Expected behavior

I expect the args marked as @deprecated to be included

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • NodeJS: [e.g. 18.5.0]
  • graphql version: [e.g. 16.3.0]
  • @graphql-codegen/* version(s): [e.g. 2.6.2]

Codegen Config File

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions