Skip to content
/ prmdg Public
forked from achiku/prmdg

prmd JSON Hyper Schema to Go struct, and validators

License

Notifications You must be signed in to change notification settings

kanmu/prmdg

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Folders and files

NameName
Last commit message
Last commit date
Oct 31, 2022
Apr 30, 2024
Jun 20, 2017
Jun 18, 2017
Dec 9, 2022
Mar 11, 2017
Dec 9, 2022
Oct 30, 2022
Oct 30, 2022
Oct 30, 2022
Oct 30, 2022
Oct 1, 2024
Apr 30, 2024
Oct 30, 2022
Oct 30, 2022
Oct 30, 2022

Repository files navigation

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 install github.com/kanmu/prmdg@latest

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

About

prmd JSON Hyper Schema to Go struct, and validators

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.1%
  • Other 0.9%