reason-graphql icon indicating copy to clipboard operation
reason-graphql copied to clipboard

Implement SDL Parsing/Printing Support

Open timkendall opened this issue 6 years ago • 4 comments

This PR implements basic support for parsing of GraphQL Schema Definition Language (support was already implemented for the Executable Definition Language of course ) as defined by the graphql-js reference implementation.

Support for parsing of SDL may be at odds with this library's goal of improved type-saftey (over the graphql-js implementation and other schema-driven GraphQL API implementation approaches) however I believe it is worth including support here as SDL parsing is a useful feature to have outside of building type-safe GraphQL API implementations. Both the EDL and SDL are tied very closely together so (I think) it makes sense to co-locate in a single package.

In any case, another option is to break this parser support out into a separate reason-graphql-parser package (seems like the Rust folks did this with graphql-rust/graphql-parser) - let me know what you think.

Great work on this library, I learned a lot about lexers, parsers, and ReasonML (haven't worked with any before, so feel free to wreck me on the review ;) ) 👍

timkendall avatar Dec 30 '19 02:12 timkendall

@timkendall Wow! huge contribution! I will take a deep look later as I am traveling right now. What prompted you to contribute to SDL parsing?

sikanhe avatar Dec 30 '19 21:12 sikanhe

Sweet, thanks!

I'm interested in SDL parsing with ReasonML as I am working on a project that generates full GraphQL API's from directive-decorated (using Apollo's Federation Spec) type definitions (like Prisma, AppSync, FaunaDB).

Currently we have this portion (the "compiler" portion) of the project written in TypeScript. Interested in using ReasonML instead however to achieve cleaner code (variants and patten matching lend themselves very nicely to compiler logic) and faster runtime (using ReasonML native compilation) as we are exposing this functionality via a Node-backed CLI interface who's startup time is egregious.

timkendall avatar Dec 31 '19 01:12 timkendall

@timkendall Do you want me to review this asap or should I wait for the checklist to complete?

sikanhe avatar Jan 10 '20 17:01 sikanhe

Ha I was going to message you. I think this PR is big enough on its own and was planning on submitting follow up PRs to address the checklist. I'll remove the checklist and you can review 👍

timkendall avatar Jan 10 '20 18:01 timkendall