Skip to content
Plumatic Schema visualization using Graphviz.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dev-resources
src/schema_viz
test/schema_viz
.gitignore
.travis.yml
CHANGES.md
CONTRIBUTING.md
README.md
project.clj

README.md

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.

You can’t perform that action at this time.