
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@baransu/graphql-ppx
Advanced tools
This is README for the upcoming 1.0 release. It's available via "@baransu/graphql_ppx@next", contains breaking changes and may not work. If you're using 0.x version please check README from master branch
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 a
graphql_schema.json
file.
The easiest way to add this to your project is using an
introspection query
to your backend. You can do this using get-graphql-schema
:
npx get-graphql-schema ENDPOINT_URL -j > graphql_schema.json
With ENDPOINT_URL
being the URL of your GraphQL endpoint.
graphql-ppx
will generate a .graphql_ppx_cache
folder alongside your JSON
schema to optimize parsing performance. If you're using a version control
system, you don't need to check it in.
The next pages will provide further installation instructions whether you are
using graphql-ppx
with Bucklescript or using Reason Native.
First, add it to you dependencies using npm
or yarn
:
yarn add @baransu/graphql_ppx_re@next --dev
# or
npm install @baransu/graphql_ppx_re@next --saveDev
Second, add it to ppx-flags
and bs-dependencies
in your bsconfig.json
:
"ppx-flags": ["@baransu/graphql_ppx_re/ppx"],
"bs-dependencies": ["@baransu/graphql_ppx_re"]
The Bucklescript version of graphql-ppx
was almost completely rewritten for the
1.0 release, with many improvements and changes. This documentation will focus
on the API of the bucklescript version. This means that most of the examples
won't apply for the Reason Native version. Please take a look at the
old documentation.
At the same time we welcome contributions to modernize the Reason Native version
of graphql-ppx
:::
You need to provide the following dependency in your esy.json
file
{
"dependencies": {
"graphql_ppx": "*"
},
"resolutions": {
"graphql_ppx": "reasonml-community/graphql_ppx:esy.json#<use latest stable commit from master>"
}
}
and update your dune
file:
(preprocess (pps graphql_ppx))
Make your first query:
[%graphql {|
query UserQuery {
user {
id
name
}
}
|}];
Open getting started in the docs
See our development board for a list of selected features and issues.
We'd love your help improving graphql-ppx
!
Take a look at our Contributing Guide to get started.
Distributed under the MIT License. See LICENSE for more information.
Thanks to everyone who contributed to graphql-ppx
!
This project builds upon mhallin/graphql_ppx. It wouldn't be possible without great work of mhallin/graphql_ppx contributors.
FAQs
graphql-ppx rewriter for Bucklescript/ReasonML
We found that @baransu/graphql-ppx demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.