Skip to content

aaharu/schemarshal

Repository files navigation

schemarshal wercker status

Coverage Status Go Report Card FOSSA Status

Generates Go struct types from a JSON Schema.

Installation

go get -u github.com/aaharu/schemarshal

Usage

SYNOPSIS
  schemarshal [options] [<json_schema_file>]
OPTIONS
  -h, -help
           Show this help message.
  -f <file>, -file <file>
           Input file name.
  -o <file>, -output <file>
           Write output to file instead of stdout.
  -p <package>, -package <package>
           Package name for output. (default `main`)
  -t <package>, -type <package>
           Set default Type name.
  -v, -version
           Show version.
  -nc, -nocomment
           Do not output comments.
# with args
schemarshal -o api/schema/gen.go -p gen -f schema.json

# pipe
curl -s "https://raw.githubusercontent.com/aaharu/schemarshal/master/test_data/disk.json" | schemarshal

TODO

  • use go/ast

Dependencies

Similar Projects

License

BSD-2-Clause

FOSSA Status