A command-line tool to generate object schemas from Go structs.
Currently it supports generating
- Yup and Zod schemas that use go-playground/validator tags.
- Dart classes via the embedded go-to-dart functionality
Useful for setting up validation for front-end development and for creating Data Transfer objects for Go APIs that have flutter clients
NOTE: still in very early development
go install github.com/golang-malawi/geneveev@latest
Generating Yup Schemas
$ geneveev generate yup -d /path/to/package/with/validated/structs/ --output-dir ./yup-schemas
Generating Zod Schemas
$ geneveev generate zod -d /path/to/package/with/validated/structs/ --output-dir ./zod-schemas
Generating Dart classes
$ geneveev generate dart -d /path/to/package/with/validated/structs/ --output-dir ./dart-classes
Generate from this
To this:
- Generates basic yup object schemas from basic Go structs
- Generates basic zod object schemas from basic Go structs
The Go-to-dart implementation helps you convert Go structs to Dart classes that can be used with json_serializable.
- Supports only structs in the same package (no generics or embedded structs yet)
- Supports primitives, slices, maps, and pointers
- Support some other arbitrary types such as
time.Time
andmo.Option
(easy to extend!) - Support for
json
tags
- Zikani Nyirenda Mwase - Maintainer
MIT LICENSE