You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 25, 2024. It is now read-only.
This is the core GraphQL query parsing and execution engine whose goal is to be
transport, server and datastore agnostic.
In order to setup an HTTP server (ie Phoenix) to handle GraphQL queries you will
need plug_graphql.
Examples for Phoenix can be found at hello_graphql_phoenix, so look here for a starting point for writing your own schemas.
Other ways of handling queries will be added in due course.
Installation
First, add GraphQL to your mix.exs dependencies:
defpdepsdo[{:graphql,"~> 0.3"}]end
Add GraphQL to your mix.exs applications:
defapplicationdo# Add the application to your list of applications.# This will ensure that it will be included in a release.[applications: [:logger,:graphql]]end
Then, update your dependencies:
$ mix deps.get
Usage
First setup your schema
defmoduleTestSchemadodefschemado%GraphQL.Schema{query: %GraphQL.Type.ObjectType{name: "RootQueryType",fields: %{greeting: %{type: %GraphQL.Type.String{},resolve: &TestSchema.greeting/3,description: "Greeting",args: %{name: %{type: %GraphQL.Type.String{},description: "The name of who you'd like to greet."},}}}}}enddefgreeting(_,%{name: name},_),do: "Hello, #{name}!"defgreeting(_,_,_),do: "Hello, world!"end
The Execution logic follows the GraphQL JS Reference Implementation pretty closely, as does the module structure of the project. Not to mention the naming of files and concepts.
If you spot anything that isn't following Elixir conventions though, that's a mistake. Please let us know by opening an issue or a PR and we'll fix it.
Developers
Getting Started
Clone the repo and fetch its dependencies:
$ git clone https://github.com/graphql-elixir/graphql.git
$ cd graphql
$ mix deps.get
$ mix test
Atom Editor Support
Using the language-erlang package? .xrl and .yrl files not syntax highlighting?
Syntax highlighting in Atom for leex (.xrl) and yecc (yrl) can be added by modifying grammars/erlang.cson.
Just open the atom-language-erlang package code in Atom and make the change described here:
however if that PR has been merged then just grab the latest version of the plugin!
Contributing
We actively welcome pull requests, bug reports, feedback, issues, questions. Come and chat in the #erlang channel on Slack
If you're planning to implement anything major, please let us know before you get too far so we can make sure your PR will be as mergable as possible. Oh, and don't forget to write tests.