jsonschema-transform

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 11 Imported by: 0

README

JSON-Schema Transform

This CLI tool is under active development and must be considered alpha. It's API may be changed in a breaking way until a 1.0 version is released. Submit issues to the Github issue tracker if found.

jsonschema-transform is a CLI utility that can transform JSON Schema into D2. This can be useful to visualize a large set of JSON Schema's that are interconnected (and possibly have remote references).

Quickstart

With default arguments, running jsonschema-transform d2 to create the d2 representation of the testdata directory:

$ jsonschema-transform d2 --globs ./testdata/*.json

A new output file named diagram.d2 is created in the current working directory. To create an SVG, change the output to a SVG filetype:

$ jsonschema-transform d2 --globs ./testdata/*.json --output diagram.svg
Installation
go install github.com/Emptyless/jsonschema-transform

Also make sure that d2 is installed:

brew install d2
Usage
  • --globs: to match containing JSON Schema documents, e.g. */*.json or ./testdata/pet.json
  • --base-uri: to use for fetching relative $refs, including file:// based $refs
  • --overwrite: allow overwrite of output file if the file exists already
  • --output: name of the output file (extension must be either 'svg' or 'd2')
  • -v (or -vv, -vvv): sets the verbosity
  • -q: quiet (opposite of verbosity)
TODO's
  • get basic structure of CLI working
  • test against more complex JSON Schema's
  • generate markdown (MD) files from the JSON schemas with clickable links
Mentions

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL