You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the past, Envelop allowed to hook into the execution at resolver level, meaning plugin was able to replace or wrap any resolver.
This was causing performance issues, since wrapping every resolver added a significant overhead.
To circumvent this issue, we removed this onResolve hook and replaced it by a plugin useOnResolve, which wraps each resolvers only when used, meaning other users doesn't have perf issues for this feature.
But it turns out we think this should not be part of Envelop at all. Envelop is meant as a runtime plugin system. This means that schema modifications should happen at schema build time, and wrapping resolvers is a schema modification.
Since this change is a breaking change and will need the refactoring of multiple plugins, it will takes time. Meanwhile, we should allow users or library maintainers using Envelop to enforce the fact the schema is not mutated during Envelop execution.
Solution
Add an option to Envelop to globally disallow the usage of useOnResolve. If this option is enabled, useOnResolve should throw a comprehensive error. It could also be a good thing to make this error message configurable, so that library maintainers can explain why this plugin is disallowed.
Alternatives
An alternative could be to freeze the schema object. But this has a cost, and the error will not be clear from a user perspective.
Additional context
This is not a perfect solution, but it's mean to gracefully guide users and library maintainers towards the removal of useOnResolve.
The text was updated successfully, but these errors were encountered:
Context
In the past, Envelop allowed to hook into the execution at resolver level, meaning plugin was able to replace or wrap any resolver.
This was causing performance issues, since wrapping every resolver added a significant overhead.
To circumvent this issue, we removed this
onResolve
hook and replaced it by a pluginuseOnResolve
, which wraps each resolvers only when used, meaning other users doesn't have perf issues for this feature.But it turns out we think this should not be part of Envelop at all. Envelop is meant as a runtime plugin system. This means that schema modifications should happen at schema build time, and wrapping resolvers is a schema modification.
Since this change is a breaking change and will need the refactoring of multiple plugins, it will takes time. Meanwhile, we should allow users or library maintainers using Envelop to enforce the fact the schema is not mutated during Envelop execution.
Solution
Add an option to Envelop to globally disallow the usage of
useOnResolve
. If this option is enabled,useOnResolve
should throw a comprehensive error. It could also be a good thing to make this error message configurable, so that library maintainers can explain why this plugin is disallowed.Alternatives
An alternative could be to freeze the schema object. But this has a cost, and the error will not be clear from a user perspective.
Additional context
This is not a perfect solution, but it's mean to gracefully guide users and library maintainers towards the removal of
useOnResolve
.The text was updated successfully, but these errors were encountered: