Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

DataSyncPlugin assumes presence of types generated by SchemCRUDPlugin #2118

Open
craicoverflow opened this issue Sep 23, 2020 · 4 comments
Open
Labels

Comments

@craicoverflow
Copy link

craicoverflow commented Sep 23, 2020

  • Module: @graphback/datasync, @graphback/codegen-schema
  • Version: *
  • Node.js / npm versions:

When CRUD flags are disabled, input types are not generated and are unavailable to non-core plugins:

Cannot find InputTypeComposer with name MutateNoteInput

I think we need to generate all input types regardless of whether they are used in SchemaCRUDPlugin, and only strip them at the very end of the plugin chain, if possible.

@machi1990
Copy link
Contributor

/cc @ssd71
Automatically generated comment to notify maintainers
/cc @machi1990, @wtrocki

@craicoverflow
Copy link
Author

In theory addSchemaMustHaveType() should be the solution to this for any type we want to preserve, but I will need to test it.

If SchemaCRUDPlugin uses this then the types will not be removed.

Then if plugin B does not use these types, they will be removed anyway without re-adding these to the must have types. Plugin C needs them but they are gone.

Probably the best solution is an upstream PR to graphql-compose.

@craicoverflow
Copy link
Author

craicoverflow commented Oct 7, 2020

Issue upstream which can resolve this: graphql-compose/graphql-compose#293
Created PR: graphql-compose/graphql-compose#294 but can see there are some tests failing.

Anyway this is low priority for now.

@nodkz
Copy link

nodkz commented Oct 11, 2020

New option SchemaComposer.buildSchema({ keepUnusedTypes: true }) was added in https://github.com/graphql-compose/graphql-compose/releases/tag/v7.22.0

@craicoverflow thanks for PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants