All Projects → tendant → Graphql Clj

tendant / Graphql Clj

Licence: epl-1.0
A Clojure library that provides GraphQL implementation.

Programming Languages

clojure
4091 projects
clj
17 projects

Projects that are alternatives of or similar to Graphql Clj

Grial
A Node.js framework for creating GraphQL API servers easily and without a lot of boilerplate.
Stars: ✭ 194 (-30.96%)
Mutual labels:  graphql, graphql-server
36 Graphql Concepts
📜 36 concepts every GraphQL developer should know.
Stars: ✭ 209 (-25.62%)
Mutual labels:  graphql, graphql-server
Gramps Legacy
The core data source combination engine of GrAMPS.
Stars: ✭ 198 (-29.54%)
Mutual labels:  graphql, graphql-server
Hotchocolate
Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
Stars: ✭ 3,009 (+970.82%)
Mutual labels:  graphql, graphql-server
Graphqlize
A Clojure & JVM library for developing GraphQL API instantly from Postgres and MySQL databases
Stars: ✭ 240 (-14.59%)
Mutual labels:  graphql, graphql-server
Graphql Spqr Spring Boot Starter
Spring Boot 2 starter powered by GraphQL SPQR
Stars: ✭ 187 (-33.45%)
Mutual labels:  graphql, graphql-server
Djangochannelsgraphqlws
Django Channels based WebSocket GraphQL server with Graphene-like subscriptions
Stars: ✭ 203 (-27.76%)
Mutual labels:  graphql, graphql-server
Gqtx
Code-first type-safe GraphQL Server without codegen or metaprogramming
Stars: ✭ 173 (-38.43%)
Mutual labels:  graphql, graphql-server
Graphql Ruby
GraphQL Ruby example for How To GraphQL
Stars: ✭ 231 (-17.79%)
Mutual labels:  graphql, graphql-server
Graphql Go Example
Example use of https://github.com/graph-gophers/graphql-go
Stars: ✭ 222 (-21%)
Mutual labels:  graphql, graphql-server
Gqlify
[NOT MAINTAINED]An API integration framework using GraphQL
Stars: ✭ 182 (-35.23%)
Mutual labels:  graphql, graphql-server
Wp Graphql
🚀 GraphQL API for WordPress
Stars: ✭ 3,097 (+1002.14%)
Mutual labels:  graphql, graphql-server
Graphql2rest
GraphQL to REST converter: automatically generate a RESTful API from your existing GraphQL API
Stars: ✭ 181 (-35.59%)
Mutual labels:  graphql, graphql-server
Blog Service
blog service @nestjs
Stars: ✭ 188 (-33.1%)
Mutual labels:  graphql, graphql-server
Storefront Api
Storefront GraphQL API Gateway. Modular architecture. ElasticSearch included. Works great with Magento1, Magento2, Spree, OpenCart, Pimcore and custom backends
Stars: ✭ 180 (-35.94%)
Mutual labels:  graphql, graphql-server
Rails Devise Graphql
A Rails 6 boilerplate to create your next Saas product. Preloaded with graphQL, devise, JWT, CanCanCan, RailsAdmin, Rubocop, Rspec, i18n and more.
Stars: ✭ 199 (-29.18%)
Mutual labels:  graphql, graphql-server
Graphql Jpa
JPA Implementation of GraphQL (builds on graphql-java)
Stars: ✭ 156 (-44.48%)
Mutual labels:  graphql, graphql-server
Pop
Monorepo of the PoP project, including: a server-side component model in PHP, a GraphQL server, a GraphQL API plugin for WordPress, and a website builder
Stars: ✭ 160 (-43.06%)
Mutual labels:  graphql, graphql-server
Graphql Rest Proxy
Turn your REST API into GraphQL - A Proxy Server that pipes request from GraphQL to REST with GraphQL DSL, performant nested children, mutations, input types, and more.
Stars: ✭ 218 (-22.42%)
Mutual labels:  graphql, graphql-server
Graphql Resolve Batch
A GraphQL batching model which groups execution by GraphQL fields.
Stars: ✭ 251 (-10.68%)
Mutual labels:  graphql, graphql-server

graphql-clj

A Clojure library designed to provide GraphQL implementation.

Build Status

Demo

Demo Project with GraphiQL

What's new in version 0.2

  1. Simplified APIs
  2. Rewrite schema and query validator for simplicity and robostness.
  3. Separate parser and validator for schema and query.
  4. High performance java parser

Installation

Add the following dependency to your project.clj file:

[graphql-clj "0.2.9"]

Usage

Define schema


(def schema-str "type User {
    name: String
    age: Int
  }
  type QueryRoot {
    user: User
  }

  schema {
    query: QueryRoot
  }")

Define resolver functions

(defn resolver-fn [type-name field-name]
  (get-in {"QueryRoot" {"user" (fn [context parent args]
                                 {:name "test user name"
                                  :age 30})}}
          [type-name field-name]))

Execute query

    (require '[graphql-clj.executor :as executor])
    (def query-str "query {user {name age}}")

    (executor/execute nil schema-str resolver-fn query-str)
    ;; => {:data {"user" {"name" "test user name", "age" 30}}}

Caching validated schema and query for performance

    (require '[graphql-clj.schema-validator :as schema-validator])
    (require '[graphql-clj.query-validator :as query-validator])
    
    ;; Consider memoizing the result of parsing and validating the query before execution
    (def validated-schema (schema-validator/validate-schema schema-str)) ; throw ex-info with ex-data {:errors errors}
    (def validated-query (query-validator/validate-query validated-schema query-str)) ; return [errors validated-ast]

    (executor/execute nil validated-schema resolver-fn validated-query)
    ;; => {:data {"user" {"name" "test user name", "age" 30}}}

Migrating from 0.1.x to 0.2 version

  1. Separated parser api for schema and query
   parser/parse-schema for schema parsing
   parser/parse-query-document for query parsing
  1. Simplified validator api, it can take query string and schema string now.
   graphql-clj.schema-validator/validate-schema replaces validator/validate-schema
   graphql-clj.query-validator/validate-query replaces validator/validate-statement
  1. executor/execute function can take string and validated result for both schema and query string.

Deploy to local for development

$ lein install

Release to Clojars

$ lein deploy clojars

Test

$ lein test

License

Copyright © 2016 Lei Wang

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

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].