metosin.schema-viz

https://github.com/metosin/schema-viz.git

git clone 'https://github.com/metosin/schema-viz.git'

(ql:quickload :metosin.schema-viz)
69

Schema-viz Build Status Dependencies Status

Plumatic Schema visualization using Graphviz.

Clojars Project

Prerequisites

Install Graphviz.

Usage

Public functions in schema-viz.core: * visualize-schemas displays schemas from a namespace in a window. * save-schemas saves 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:

Schema

License

Copyright © 2015-2016 Metosin Oy

Distributed under the Eclipse Public License, the same as Clojure.