Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/r0man/alumbra.printer

A pretty printer for the Alumbra AST
https://github.com/r0man/alumbra.printer

alumbra clojure clojurescript graphql

Last synced: about 2 months ago
JSON representation

A pretty printer for the Alumbra AST

Awesome Lists containing this project

README

        

* alumbra.printer
:PROPERTIES:
:CUSTOM_ID: alumbra.printer
:END:

[[https://clojars.org/r0man/alumbra.printer][https://img.shields.io/clojars/v/r0man/alumbra.printer.svg]]
[[https://travis-ci.org/r0man/alumbra.printer][https://travis-ci.org/r0man/alumbra.printer.svg]]
[[https://versions.deps.co/r0man/alumbra.printer][https://versions.deps.co/r0man/alumbra.printer/status.svg]]
[[https://versions.deps.co/r0man/alumbra.printer][https://jarkeeper.com/r0man/alumbra.printer/downloads.svg]]

A pretty printer for the [[https://github.com/alumbra][Alumbra]] AST.

** Usage
:PROPERTIES:
:CUSTOM_ID: usage
:END:

Parse a GraphQL document.

#+BEGIN_SRC clojure :exports code :results silent
(require '[alumbra.parser :as parser])
(require '[alumbra.printer :as printer])

(def my-document
(parser/parse-document "{ human(id: \"1000\") { name height(unit: FOOT) } }"))
#+END_SRC

Print the document.

#+BEGIN_SRC clojure :exports both :results output
(printer/print my-document)
#+END_SRC

#+RESULTS:
: query { human(id: "1000") { name height(unit: FOOT) } }

Pretty print the document.

#+BEGIN_SRC clojure :exports both :results output
(printer/pprint my-document)
#+END_SRC

#+RESULTS:
: query {
: human(id: "1000") {
: name
: height(unit: FOOT)
: }
: }

** License
:PROPERTIES:
:CUSTOM_ID: license
:END:

MIT License, Copyright (c) 2019 [[https://github.com/r0man][r0man]]