Skip to content

kitagry/gostjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gostjs

Create JSON Schema from golang struct.

Installation

go get github.com/kitagry/gostjs

Usage

Usage of gostjs:
  -output string
        output file name
  -src-path string
        go build src path
  -tag string
        tag name (default "json")
$ gostjs github.com/kitagry/gostjs/test.Test | gojq
{
  "$schema": "http://json-schema.org/schema#",
  "description": "Test's docs\n",
  "properties": {
    "": {
      "properties": {
        "Name": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "Child2": {
      "properties": {
        "Name": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "Interface": {
      "type": ""
    },
    "array": {
      "contains": {
        "type": "string"
      },
      "type": "array"
    },
    "child": {
      "properties": {
        "Name": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "id": {
      "type": "number"
    },
    "map": {
      "additionalProperties": {
        "type": "string"
      },
      "type": "object"
    },
    "name": {
      "description": "Name is name\n",
      "type": "string"
    }
  },
  "type": "object"
}

License

MIT

About

[WIP] Create Json Schema from Go struct.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages