schema-viz
schema-viz copied to clipboard
Plumatic Schema visualization using Graphviz.
Schema-viz

Plumatic Schema visualization using Graphviz.
Prerequisites
Install Graphviz.
Usage
Public functions in schema-viz.core:
visualize-schemasdisplays schemas from a namespace in a window.save-schemassaves schema visualization in a file.
Both take an optional options-map to configure the rendering process. See docs for details.
(require '[schema-viz.core :as svc])
(require '[schema.core :as s])
(s/defschema Country
{:name (s/enum :FI :PO)
:neighbors [(s/recursive #'Country)]})
(s/defschema Burger
{:name s/Str
(s/optional-key :description) s/Str
:origin (s/maybe Country)
:price (s/constrained s/Int pos?)
s/Keyword s/Any})
(s/defschema OrderLine
{:burger Burger
:amount s/Int})
(s/defschema Order
{:lines [OrderLine]
:delivery {:delivered s/Bool
:address {:street s/Str
:zip s/Int
:country Country}}})
(svc/visualize-schemas)
Produces the following:

License
Copyright © 2015-2016 Metosin Oy
Distributed under the Eclipse Public License, the same as Clojure.