- Notifications
You must be signed in to change notification settings - Fork53
GraphQL language primitives for ReScript/ReasonML written in ReasonML
License
teamwalnut/graphql-ppx
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Typesafe GraphQL operations and fragments in ReasonML
Documentation •Features •Installation •Usage •Roadmap •Contributing •License •Acknowledgements
Go to the official documentation
Language level GraphQL primitives
Building block for GraphQL clients
100% type safe
graphql-ppx needs your graphql schema to be available in the form of agraphql_schema.json file.
The easiest way to add this to your project is using anintrospection queryto your backend. You can do this usingget-graphql-schema:
npx get-graphql-schema ENDPOINT_URL -j> graphql_schema.jsonWithENDPOINT_URL being the URL of your GraphQL endpoint.
graphql-ppx will generate a.graphql_ppx_cache folder alongside your JSONschema to optimize parsing performance. If you're using a version controlsystem, you don't need to check it in.
The next pages will provide further installation instructions whether you areusinggraphql-ppx with Bucklescript or using Reason Native.
First, add it to you dependencies usingnpm oryarn:
yarn add @reasonml-community/graphql-ppx --dev# ornpm install @reasonml-community/graphql-ppx --saveDevSecond, add it toppx-flags andbs-dependencies in yourbsconfig.json:
"ppx-flags": ["@reasonml-community/graphql-ppx/ppx"],"bs-dependencies": ["@reasonml-community/graphql-ppx"]
The Bucklescript version ofgraphql-ppx was almost completely rewritten for the1.0 release, with many improvements and changes. This documentation will focuson the API of the bucklescript version. This means that most of the exampleswon't apply for the Reason Native version. Please take a look at theold documentation.At the same time we welcome contributions to modernize the Reason Native versionofgraphql-ppx:::
You need to provide the following dependency in youresy.json file
{"dependencies": {"graphql-ppx":"*" },"resolutions": {"graphql-ppx":"reasonml-community/graphql-ppx:esy.json#<use latest stable commit from master>" }}and update yourdune file:
(preprocess (pps graphql_ppx))Make your first query:
[%graphql{| query UserQuery { user { id name } }|}];
%graphql(` query UserQuery { user { id name } }`)
Open getting started in the docs
See ourdevelopment board for a list of selected features and issues.
We'd love your help improvinggraphql-ppx!
Take a look at ourContributing Guide to get started.
Distributed under the MIT License. SeeLICENSE for more information.
Thanks to everyone whocontributed tographql-ppx!
This project builds uponmhallin/graphql_ppx. It wouldn't be possible withoutgreat work ofmhallin/graphql_ppx contributors.1
About
GraphQL language primitives for ReScript/ReasonML written in ReasonML
Topics
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.