Skip to content

A command-line tool to generate Yup, Zod schemas and Dart classes from Go structs

Notifications You must be signed in to change notification settings

golang-malawi/geneveev

Repository files navigation

geneveev

A command-line tool to generate object schemas from Go structs.

Currently it supports generating

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

Installation

go install github.com/golang-malawi/geneveev@latest

Usage

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

Example

Generate from this

[]

To this:

[]

Features

Yup Schema

  • Generates basic yup object schemas from basic Go structs

Zod Schema

  • Generates basic zod object schemas from basic Go structs

go-to-dart

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 and mo.Option (easy to extend!)
  • Support for json tags

Contributors

LICENSE

MIT LICENSE

About

A command-line tool to generate Yup, Zod schemas and Dart classes from Go structs

Resources

Stars

Watchers

Forks

Packages

No packages published