feat(mergeAST): add mergeAST utility#4359
Conversation
@0042834736 The latest changes of this PR are available on NPM as Also you can depend on latest version built from this PR: |
|
One thing we should very much keep in mind with |
|
Thanks @benjie . You're absolutely right: mergeAST introduces complexity risks, especially if used on unvalidated or hostile input. My intention with duplicated the utility from GraphiQL is to support use cases like: dynamically composing selection sets, merging query documents for internal middleware, or some other client side use cases, or Building tooling that operates on statically constructed or pre-validated ASTs. But yeah it might introduce reliability and security risks in server-side GraphQL environments. Given that context, I'd be happy to explore ways to make the function safer or more clearly scoped, I am thinking,
It might not be able to prevent all the malicious input I think. Would love your thoughts on whether any of these sound like a reasonable direction. I'm happy to iterate and contribute safeguards in this PR or a follow-up depending on what fits best with the project’s expectations. |
|
It might be best that you break it out into its own library for now. I'd want to carefully test (and probably rewrite) it before incorporating it into GraphQL.js, even with the rename. |
This PR is adding utility of merge AST by simply migrating it from graphiql
As first step to resolve this issue #1428 (comment)