-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Currently, if I understand the flow correctly, to skip schema validation during an execute call, one must create a schema with the assumeValid
option (as opposed to an explicit execute option for this different execute behavior. Using the option sets an internal assumeValid
flag, which is picked up by execute.
This same internal schema flag is set to true no matter what when the schema is actually validated, so that validation can be skipped when run on the same schema, even when the option is not set.
These two different use cases cause some problems for schema semantics when mapping schemas (ardatan/graphql-tools#4087). There is currently a bug in the graphql-tools mapping code where a schema that has been previously validated will carry over the flag to a new, potentially invalid schema. The fix would simply be to drop the flag, but that would cause issues for users who are using the option/flag explicitly.
Specifically, if users were creating a schema using the option/flag so as to avoid validation later, and then mapping it using mapSchema, the flag would now be dropped, and they would have to readd it using toConfig and creating a new schema. A new option could be added to mapSchema to add this exact behavior, fixing the issue there, and users could be educated that any execution level flags must be set on the final schema rather than the original schema. [This is especially true because multiple schemas can be created from an original schema
However, this flow seems awkward. An execution level flag should probably be settable at execution.
There is a related discussion with respect to defer/stream directives : graphql/defer-stream-wg#12 for a parallel issue/discussion.
However, there is an important difference there in that the schema is actually different when defer/stream is enabled, i.e. it creates the directives. Is there an actual different within the schema at generation time when assumeValid is set.
I expect I am missing some aspects/angles on this issue. The above just reflects my current thoughts, would be happy to hear any and all additional input!