Skip to content

karuppiah7890/go-jsonschema-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-jsonschema-generator Build Status GoDoc

json-schema generator based on Go types

Installation

The recommended way to install go-jsonschema-generator

go get github.com/mcuadros/go-jsonschema-generator

Examples

A basic example:

package main

import (
    "fmt"
    "github.com/mcuadros/go-jsonschema-generator"
)

type ExampleBasic struct {
    Foo bool   `json:"foo"`
    Bar string `json:",omitempty"`
    Qux int8
}

func main() {
    j := &jsonschema.JSONSchema{}
    j.Load(&ExampleBasic{})

    fmt.Println(j)
}
{
  "type": "object",
  "properties": {
    "Bar": {
      "type": "string"
    },
    "Qux": {
      "type": "integer"
    },
    "foo": {
      "type": "bool"
    }
  },
  "required": [
    "foo",
    "Qux"
  ]
}

License

MIT, see LICENSE

About

json-schemas generator based on Go types

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%