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

Support custom document loading #483

Closed
williambailey opened this issue Apr 30, 2019 · 2 comments
Closed

Support custom document loading #483

williambailey opened this issue Apr 30, 2019 · 2 comments

Comments

@williambailey
Copy link
Contributor

It would be nice to be able to provide a function to support custom document loading. Being able to extend/augment/replace the new Source(...), parse(source), validateFn(...) process would make implementing functionality like persisted document storage easier and also allow the server to skip the document parsing and validation stages for known/frequent documents.

@IvanGoncharov
Copy link
Member

@williambailey Great suggestion 👍
I think the ability to replace parse is a great feature.
If you want to work on PR it should be very similar to #391

extend/augment/replace the new Source(...),

Source is a very primitive class so I don't think we should bother to replace it.
You can always access the original query as source.body.
https://github.com/graphql/graphql-js/blob/cd80f94edc584c5cf3258d27b6f91ab3b72f0cce/src/language/source.js#L31-L44

@IvanGoncharov
Copy link
Member

I'm closing this issue since progress is tracked in #484

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

No branches or pull requests

2 participants