Dan Anglin
d01c4389be
Main changes: - Add an option to add multi-line comments at the top of the generated file. - Add an option to name the top-level type. Additional changes: - Replace deprecated strings.Title with a custom title function. - Refactor code based on linter feedback. - Update LICENSE. - Update go.mod and upgrade github.com/dave/jennifer from v1.5.1 to v1.7.0. - Update documentation. |
||
---|---|---|
cmd/go-jsonschema | ||
go.mod | ||
go.sum | ||
LICENSE | ||
README.md | ||
schema.go |
go-jsonschema
A JSON schema code generator for Go.
JSON schema draft 2020-12 is supported.
This project is a fork of https://git.sr.ht/~emersion/go-jsonschema with the following changes:
- Add the option to add multi-line comments at the top of the generated file.
- Add the option to name the top-level type.
Usage
go-jsonschema -s <schema> -o <output>
One Go type per definition will be generated.
int64
is used for"type": "integer"
.json.Number
is used for"type": "number"
.- Go structs are generated for objects with
"additionalProperties": false
. json.RawMessage
is used when a value can have multiple types. Helpers are generated forallOf
,anyOf
,oneOf
,then
,else
anddependantSchemas
which are references.
Contributing
Report bugs and send patches to the mailing list. Discuss in #emersion on Libera Chat.
License
MIT