prmdg

command module
v0.0.0-...-40fc73c Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2019 License: MIT Imports: 19 Imported by: 0

README

prmdg

Build Status GitHub license Go Report Card

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 [<flags>] <command> [<args> ...]

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 file

Commands:
  help [<command>...]
    Show help.

  struct [<flags>]
    generate struct file

  jsval
    generate validator file using github.com/lestrrat-go/go-jsval

  validator
    generate validator file using github.com/go-playground/validator

Generating struct from JSON Hyper Schema

usage: prmdg struct [<flags>]

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 jsval

generate 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 validator

generate 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

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