All Projects → oliyh → Locksmith

oliyh / Locksmith

Want to use GraphQL with Clojure/script but don't want keBab or snake_keys everywhere? Use locksmith to change all the keys!

Programming Languages

clojure
4091 projects
clojurescript
191 projects
cljs
18 projects
clj
17 projects

Projects that are alternatives of or similar to Locksmith

Fullstack Graphql
🌈 Simple Fullstack GraphQL Application. API built with Express + GraphQL + Sequelize (supports MySQL, Postgres, Sqlite and MSSQL). WebApp built with React + Redux to access the API. Written in ES6 using Babel + Webpack.
Stars: ✭ 955 (+1518.64%)
Mutual labels:  graphql, graphql-server, graphql-client
Gqlify
[NOT MAINTAINED]An API integration framework using GraphQL
Stars: ✭ 182 (+208.47%)
Mutual labels:  graphql, graphql-server, graphql-client
Qlens
QLens is an electron app which dynamically generates GraphQL Schemas and Mongo Schema visualization. QLens significantly cuts development time by automating the formation of their GraphQL schemas based on information fetched from their non-relational database.
Stars: ✭ 110 (+86.44%)
Mutual labels:  graphql, graphql-server, graphql-client
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 (+5000%)
Mutual labels:  graphql, graphql-server, graphql-client
Graphql Kotlin
Libraries for running GraphQL in Kotlin
Stars: ✭ 1,030 (+1645.76%)
Mutual labels:  graphql, graphql-server, graphql-client
Pup
The Ultimate Boilerplate for Products.
Stars: ✭ 563 (+854.24%)
Mutual labels:  graphql, graphql-server, graphql-client
Graphql Stack
A visual explanation of how the various tools in the GraphQL ecosystem fit together.
Stars: ✭ 117 (+98.31%)
Mutual labels:  graphql, graphql-server, graphql-client
36 Graphql Concepts
📜 36 concepts every GraphQL developer should know.
Stars: ✭ 209 (+254.24%)
Mutual labels:  graphql, graphql-server, graphql-client
Morpheus Graphql
Haskell GraphQL Api, Client and Tools
Stars: ✭ 285 (+383.05%)
Mutual labels:  graphql, graphql-server, graphql-client
Altair
✨⚡️ A beautiful feature-rich GraphQL Client for all platforms.
Stars: ✭ 3,827 (+6386.44%)
Mutual labels:  graphql, graphql-server, graphql-client
Caliban
Functional GraphQL library for Scala
Stars: ✭ 581 (+884.75%)
Mutual labels:  graphql, graphql-server, graphql-client
Graphql Api Gateway
An open-sourced example of a GraphQL API Gateway. This service queries and joins data across different back-ends into one GraphQL schema.
Stars: ✭ 57 (-3.39%)
Mutual labels:  graphql, graphql-server
Eschool
eSchool Microservice based Solution
Stars: ✭ 29 (-50.85%)
Mutual labels:  graphql, graphql-server
Turbulette
😴 Turbulette - A batteries-included framework to build high performance, fully async GraphQL APIs
Stars: ✭ 29 (-50.85%)
Mutual labels:  graphql, graphql-server
Graphql Client
A Ruby library for declaring, composing and executing GraphQL queries
Stars: ✭ 961 (+1528.81%)
Mutual labels:  graphql, graphql-client
Graphql Modules
Enterprise Grade Tooling For Your GraphQL Server
Stars: ✭ 962 (+1530.51%)
Mutual labels:  graphql, graphql-server
Orionjs
A new framework for serverside GraphQL apps
Stars: ✭ 35 (-40.68%)
Mutual labels:  graphql, graphql-server
Graphqldockerproxy
A generic Graphql API for Docker and Kubernetes
Stars: ✭ 38 (-35.59%)
Mutual labels:  graphql, graphql-server
Ultimate Backend
Multi tenant SaaS starter kit with cqrs graphql microservice architecture, apollo federation, event source and authentication
Stars: ✭ 978 (+1557.63%)
Mutual labels:  graphql, graphql-server
Graphql Spqr
Java 8+ API for rapid development of GraphQL services
Stars: ✭ 843 (+1328.81%)
Mutual labels:  graphql, graphql-server

locksmith

Want to use GraphQL with Clojure/script but don't want snake_keys or camelKeys everywhere? Use locksmith to change all the keys!

locksmith creates efficient functions to transform GraphQL keys (e.g. snake_key, camelKey, boolean_key) into Clojure keys (snake-key, camel-key, boolean-key?) and vice versa. It does this by inspecting your lacinia GraphQL schema, deciding which keys need renaming and composing functions to do the renames as fast as possible.

This helps you satisfy GraphQL queries on your server and work with idiomatic Clojure data on your client. It uses camel-snake-kebab under the hood, with the addition of adding ? as a suffix for boolean types.

Clojars Project

Usage

Imagine you have a schema for a car race, as follows:

(def lacinia-schema
  '{:enums {:team_name {:description "Some enumerated teams"
                        :values [:ferrari_scuderia :red_bull :mercedes_gp]}}

    :objects {:car_race {:fields {:winning_driver {:type :car_driver}
                                  :competing_drivers {:type (list :car_driver)}
                                  :country_name {:type String}}}
              :car_driver {:fields {:first_name {:type String}
                                    :team_name {:type :team_name}
                                    :champion {:type Boolean}}}}})

On your server you have lots of lovely Clojure data, but you have to put loads of underscores or camels in it to satisfy any GraphQL queries that come in. locksmith's clj->gql does this for you!

(let [car-race-converter (clj->gql lacinia-schema :car_race)]
  (car-race-converter {:country-name "GB"
                       :winning-driver {:first-name "Lewis"
                                        :team-name :mercedes-gp
                                        :champion? true}
                       :competing-drivers [{:first-name "Lewis"
                                            :team-name :mercedes-gp
                                            :champion? true}
                                           {:first-name "Sebastian"
                                            :team-name :ferrari-scuderia
                                            :champion? true}
                                           {:first-name "Max"
                                            :team-name :red-bull
                                            :champion? false}]}))

;; {:country_name "GB",
;;  :competing_drivers
;;  ({:champion true, :team_name "mercedes_gp", :first_name "Lewis"}
;;   {:champion true,
;;    :team_name "ferrari_scuderia",
;;    :first_name "Sebastian"}
;;   {:champion false, :team_name "red_bull", :first_name "Max"}),
;;  :winning_driver
;;  {:champion true, :team_name "mercedes_gp", :first_name "Lewis"}}

On your client you crave Clojure data, but the GraphQL server is trying to force feed you underscores or camels. locksmith's gql->clj sorts it out!

(let [car-race-converter (gql->clj lacinia-schema :car_race)]
  (car-race-converter {:country_name "GB"
                       :winning_driver {:first_name "Lewis"
                                        :team_name "mercedes_gp"
                                        :champion true}
                       :competing_drivers [{:first_name "Lewis"
                                            :team_name "mercedes_gp"
                                            :champion true}
                                           {:first_name "Sebastian"
                                            :team_name "ferrari_scuderia"
                                            :champion true}
                                           {:first_name "Max"
                                            :team_name "red_bull"
                                            :champion false}]}))

;; {:country-name "GB",
;;  :competing-drivers
;;  ({:champion? true, :team-name :mercedes-gp, :first-name "Lewis"}
;;   {:champion? true,
;;    :team-name :ferrari-scuderia,
;;    :first-name "Sebastian"}
;;   {:champion? false, :team-name :red-bull, :first-name "Max"}),
;;  :winning-driver
;;  {:champion? true, :team-name :mercedes-gp, :first-name "Lewis"}}

Development

CircleCI

License

Copyright © 2017 oliyh

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