Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/achiku/prmdg
prmd JSON Hyper Schema to Go struct, and validators
https://github.com/achiku/prmdg
golang json-hyper-schema json-schema prmd
Last synced: 3 months ago
JSON representation
prmd JSON Hyper Schema to Go struct, and validators
- Host: GitHub
- URL: https://github.com/achiku/prmdg
- Owner: achiku
- License: mit
- Created: 2017-03-11T07:35:45.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-10-30T06:24:54.000Z (about 2 years ago)
- Last Synced: 2024-06-19T11:33:08.044Z (7 months ago)
- Topics: golang, json-hyper-schema, json-schema, prmd
- Language: Go
- Homepage:
- Size: 93.8 KB
- Stars: 2
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# prmdg
[![Build Status](https://travis-ci.org/achiku/prmdg.svg?branch=master)](https://travis-ci.org/achiku/prmdg)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/achiku/prmdg/master/LICENSE)
[![Go Report Card](https://goreportcard.com/badge/github.com/achiku/prmdg)](https://goreportcard.com/report/github.com/achiku/prmdg)prmd style JSON Hyper Schema to Go structs, and validators
## Why created
## Prerequisite
```
go get -u golang.org/x/tools/cmd/goimports
````prmdg` applies `goimports` to the ourput file.
## Installation
```
go get -u github.com/achiku/prmdg
```If you want to use `github.com/gureg/null` in Go struct by adding `--nullable` option, you need to install `github.com/gureg/null` first.
## Usage
```
usage: prmdg --file=FILE [] [ ...]prmd generated JSON Hyper Schema to Go
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
-p, --package="main" package name for Go file
-f, --file=FILE path JSON Schema
-o, --output=OUTPUT path to Go output fileCommands:
help [...]
Show help.struct []
generate struct filejsval
generate validator file using github.com/lestrrat-go/go-jsvalvalidator
generate validator file using github.com/go-playground/validator```
## Generating struct from JSON Hyper Schema
```
usage: prmdg struct []generate struct file
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
-p, --package="main" package name for Go file
-f, --file=FILE path JSON Schema
-o, --output=OUTPUT path to Go output file
--validate-tag add `validate` tag to struct
--use-title use title tag in request/response struct name
--nullable use github.com/guregu/null for null value
```## Generating validator from JSON Hyper Schema
```
usage: prmdg jsvalgenerate validator file using github.com/lestrrat-go/go-jsval
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
-p, --package="main" package name for Go file
-f, --file=FILE path JSON Schema
-o, --output=OUTPUT path to Go output file```
```
usage: prmdg validatorgenerate validator file using github.com/go-playground/validator
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
-p, --package="main" package name for Go file
-f, --file=FILE path JSON Schema
-o, --output=OUTPUT path to Go output file```