Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aaharu/schemarshal
Generates Go struct types from a JSON Schema.
https://github.com/aaharu/schemarshal
go go-generate json-schema json-schema-to-go-structs struct
Last synced: about 1 month ago
JSON representation
Generates Go struct types from a JSON Schema.
- Host: GitHub
- URL: https://github.com/aaharu/schemarshal
- Owner: aaharu
- License: bsd-2-clause
- Created: 2017-01-03T17:12:53.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-04T19:18:00.000Z (over 6 years ago)
- Last Synced: 2024-11-24T16:58:12.960Z (about 1 month ago)
- Topics: go, go-generate, json-schema, json-schema-to-go-structs, struct
- Language: Go
- Size: 96.7 KB
- Stars: 6
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# schemarshal [![wercker status](https://app.wercker.com/status/ebb1f8ec249177acd0d47bd8a6a59dd2/s/master "wercker status")](https://app.wercker.com/project/byKey/ebb1f8ec249177acd0d47bd8a6a59dd2)
[![Coverage Status](https://coveralls.io/repos/github/aaharu/schemarshal/badge.svg)](https://coveralls.io/github/aaharu/schemarshal)
[![Go Report Card](https://goreportcard.com/badge/github.com/aaharu/schemarshal)](https://goreportcard.com/report/github.com/aaharu/schemarshal)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Faaharu%2Fschemarshal.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Faaharu%2Fschemarshal?ref=badge_shield)Generates Go struct types from a [JSON Schema](http://json-schema.org/).
## Installation
```bash
go get -u github.com/aaharu/schemarshal
```## Usage
```
SYNOPSIS
schemarshal [options] []
OPTIONS
-h, -help
Show this help message.
-f , -file
Input file name.
-o , -output
Write output to file instead of stdout.
-p , -package
Package name for output. (default `main`)
-t , -type
Set default Type name.
-v, -version
Show version.
-nc, -nocomment
Do not output comments.
``````bash
# 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
## [Examples](examples.md)
- [example a.json](examples.md#ajson)
- [example qiita schema](examples.md#qiita-v2-schema)## Dependencies
* https://github.com/lestrrat/go-jsschema
- JSON Schema parser
- MIT License
* golang.org/x/crypto/ssh/terminal
- https://godoc.org/golang.org/x/crypto/ssh/terminal
- https://golang.org/LICENSE## Similar Projects
* https://github.com/idubinskiy/schematyper
* https://github.com/dameleon/structr
* https://github.com/interagent/schematic## License
BSD-2-Clause
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Faaharu%2Fschemarshal.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Faaharu%2Fschemarshal?ref=badge_large)