Skip to content

extendSchema() doesn't set GraphQLSchema.description in some cases #3629

Closed
@sachindshinde

Description

@sachindshinde

extendSchema() doesn't set GraphQLSchema.description if the schema definition is in the input GraphQLSchema instead of the AST.

Example
Running this code:

import { buildSchema, extendSchema, parse } from "graphql";

const extendedSchema = extendSchema(
  buildSchema(`
    "A schema description"
    schema {
      query: Foo
    }
    
    type Foo {
      foo: String
    }
  `),
  parse(`scalar Bar`),
);

console.log(`AST description: ${extendedSchema.astNode?.description?.value}`);
console.log(`GraphQLSchema description: ${extendedSchema.description}`);

will print this:

AST description: A schema description
GraphQLSchema description: undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions