Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Options.schema is overwritten #316

Closed
NickBolles opened this issue Jul 3, 2019 · 2 comments
Closed

Options.schema is overwritten #316

NickBolles opened this issue Jul 3, 2019 · 2 comments

Comments

@NickBolles
Copy link
Contributor

NickBolles commented Jul 3, 2019

I'm submitting a...


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

The schema passed in via the options.schema property is overwritten by the auto generated schema.

The schema passed in is merged to the executable schema built by the module here:
https://github.com/nestjs/graphql/blob/master/lib/graphql.factory.ts#L57

 let schema = options.schema
        ? mergeSchemas({
            schemas: [options.schema, executableSchema],
          })
        : executableSchema;

but the next 4 statements overwrite the schema

      const autoGeneratedSchemaConfig = autoGeneratedSchema.toConfig();
      const executableSchemaConfig = executableSchema.toConfig();
      const schemaConfig = this.overrideOrExtendResolvers(
        executableSchemaConfig,
        autoGeneratedSchemaConfig,
      );

      schema = new GraphQLSchema(schemaConfig);

Background

Added by PR

https://github.com/nestjs/graphql/pull/50/files

modified by this commit - bugfix() workaround - multiple graphql packages

56816b4

bug actually introduced in this commit, this change

775beca#diff-80fdafbe4271cf8fbb25f5506d9a3e8eR62

possibly related issue?

#76
#307

#98

Expected behavior

correctly merge the schemas

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

allow passing a schema in to merge to the auto generated schema

@NickBolles NickBolles changed the title passed in schema is ignored Options.schema is overwritten Jul 3, 2019
@kamilmysliwiec
Copy link
Member

Fixed in 6.3.1 :)

@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants