All Projects → graphql-elixir → Graphql

graphql-elixir / Graphql

Licence: other
GraphQL Elixir

Programming Languages

elixir
2628 projects
erlang
1774 projects

Labels

Projects that are alternatives of or similar to Graphql

Api
Stars: ✭ 18 (-97.89%)
Mutual labels:  graphql
E2e Ts Gql Workshop
End-to-end Type-Safe GraphQL Workshop
Stars: ✭ 24 (-97.19%)
Mutual labels:  graphql
Kikstart Graphql Client
🚀 Small NodeJS Wrapper around apollo-client that provides easy access to running queries, mutations and subscriptions.
Stars: ✭ 27 (-96.84%)
Mutual labels:  graphql
Graphql Server Demo
GraphQL server demo with nodejs
Stars: ✭ 19 (-97.78%)
Mutual labels:  graphql
Swapi Graphql
A GraphQL schema and server wrapping SWAPI.
Stars: ✭ 921 (+7.85%)
Mutual labels:  graphql
Graphqlphpgenerator
GraphQL PHP types generator...
Stars: ✭ 25 (-97.07%)
Mutual labels:  graphql
Strawberry
A new GraphQL library for Python 🍓
Stars: ✭ 891 (+4.33%)
Mutual labels:  graphql
Speako
A compiler for GraphQL schema language (written in ClojureScript)
Stars: ✭ 8 (-99.06%)
Mutual labels:  graphql
Apollo Link Maxage
An Apollo Link to invalidate cached queries
Stars: ✭ 23 (-97.31%)
Mutual labels:  graphql
React Apollo Koa Example
An example app using React, Apollo and Koa
Stars: ✭ 26 (-96.96%)
Mutual labels:  graphql
Swapi Graphql Lambda
A GraphQL schema hosted in AWS Lambda wrapping http://swapi.co/
Stars: ✭ 19 (-97.78%)
Mutual labels:  graphql
Graphql Moltin Server
⚛️ GraphQL + Moltin + GraphQL Yoga 🧘
Stars: ✭ 22 (-97.42%)
Mutual labels:  graphql
Merge Graphql Schemas
A utility library to facilitate merging of modularized GraphQL schemas and resolver objects.
Stars: ✭ 935 (+9.48%)
Mutual labels:  graphql
Gatsby Simplefolio
⚡️ A minimal Gatsby portfolio template for Developers
Stars: ✭ 895 (+4.8%)
Mutual labels:  graphql
Ezplatform Graphql
GraphQL server for eZ Platform, the open source Symfony CMS.
Stars: ✭ 27 (-96.84%)
Mutual labels:  graphql
React Hasura Todo
A react todo app using Hasura Graphql engine
Stars: ✭ 18 (-97.89%)
Mutual labels:  graphql
Jsonschema2graphql
Convert JSON schema to GraphQL types
Stars: ✭ 24 (-97.19%)
Mutual labels:  graphql
Graphql React Apollo
A GraphQL implementation in React using Apollo.
Stars: ✭ 9 (-98.95%)
Mutual labels:  graphql
Graphql Spqr
Java 8+ API for rapid development of GraphQL services
Stars: ✭ 843 (-1.29%)
Mutual labels:  graphql
Lighthouse Utils
An add-on to Lighthouse to auto-generate CRUD actions from types https://github.com/nuwave/lighthouse
Stars: ✭ 26 (-96.96%)
Mutual labels:  graphql

GraphQL Elixir

Build Status Public Slack Discussion

An Elixir implementation of Facebook's GraphQL.

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:

defp deps do
  [{:graphql, "~> 0.3"}]
end

Add GraphQL to your mix.exs applications:

def application do
  # 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

defmodule TestSchema do
  def schema do
    %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."},
            }
          }
        }
      }
    }
  end

  def greeting(_, %{name: name}, _), do: "Hello, #{name}!"
  def greeting(_, _, _), do: "Hello, world!"
end

Execute a simple GraphQL query

iex> GraphQL.execute(TestSchema.schema, "{greeting}")
{:ok, %{data: %{"greeting" => "Hello, world!"}}}

Status

This is a work in progress, right now here's what is done:

  • [x] Parser for GraphQL (including Type definitions)
  • [x] AST matching the graphql-js types as closely as possible
  • [x] Schema definition
  • [x] Query execution
    • [x] Scalar types
    • [x] Arguments
    • [x] Multiple forms of resolution
    • [x] Complex types (List, Object, etc)
    • [x] Fragments in queries
    • [x] Extract variable values
  • [x] Introspection
  • [WIP] Query validation
  • [ ] Directives

Resources

Implementation

Tokenisation is done with leex and parsing with yecc. Both very useful Erlang tools for parsing. Yecc in particular is used by Elixir itself.

Some resources on using leex and yecc:

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:

https://github.com/jonathanmarvens/atom-language-erlang/pull/11

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.

License

BSD.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].