Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wy-z/tspec
Parse golang data structure into json schema.
https://github.com/wy-z/tspec
ast go json-schema openapi schema tspec
Last synced: 22 days ago
JSON representation
Parse golang data structure into json schema.
- Host: GitHub
- URL: https://github.com/wy-z/tspec
- Owner: wy-z
- License: mit
- Created: 2017-07-18T08:14:29.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-09T04:32:41.000Z (almost 6 years ago)
- Last Synced: 2024-10-01T14:51:44.003Z (about 1 month ago)
- Topics: ast, go, json-schema, openapi, schema, tspec
- Language: Go
- Homepage:
- Size: 7.07 MB
- Stars: 5
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tspec
[![Build Status](https://travis-ci.org/wy-z/tspec.svg?branch=master)](https://travis-ci.org/wy-z/tspec) [![GoDoc](https://godoc.org/github.com/wy-z/tspec?status.svg)](http://godoc.org/github.com/wy-z/tspec) [![Go Report Card](https://goreportcard.com/badge/github.com/wy-z/tspec)](https://goreportcard.com/report/github.com/wy-z/tspec)Parse golang data structure into json schema.
## Installation
```
go get github.com/wy-z/tspec/...
```
Or
```
import "github.com/wy-z/tspec/tspec" # see cmd/tspec/cli.go
```## Usage
```
NAME:
TSpec - Parse golang data structure into json schema.USAGE:
tspec [global options] command [command options] [arguments...]VERSION:
2.2.6COMMANDS:
help, h Shows a list of commands or help for one commandGLOBAL OPTIONS:
--package PKG, -p PKG package path PKG (default: ".")
--expressions EXPRS, --exprs EXPRS (any-of required) type expressions, seperated by ',' EXPRS
--decorator DECORATOR, -d DECORATOR (any-of required) parse package with decorator DECORATOR
--ref-prefix PREFIX, --rp PREFIX the prefix of ref url PREFIX (default: "#/definitions/")
--ignore-json-tag, --igt ignore json tag
--help, -h show help
--version, -v print the version
```## QuickStart
`tspec -p github.com/wy-z/tspec/samples -exprs BasicTypes,NormalStruct`
Or
`tspec -p github.com/wy-z/tspec/samples BasicTypes NormalStruct`## Samples
see `github.com/wy-z/tspec/samples/source`
## Test
```
go get -u github.com/jteeuwen/go-bindata/...
go generate ./samples && go test -v ./tspec
```