Code Monkey home page Code Monkey logo

geneveev's Introduction

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 -d /path/to/package/with/validated/structs/ -output-dir ./yup-schemas

Generating Zod Schemas

$ geneveev -zod -d /path/to/package/with/validated/structs/ -output-dir ./zod-schemas

Generating Dart classes

$ geneveev -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

geneveev's People

Contributors

zikani03 avatar

Stargazers

Rodger Kumwanje avatar Watipaso RattleStack Chirambo avatar Precious Nyasulu avatar  avatar Hope Kalitera avatar HBFL3Xx avatar Joel Fickson avatar Walter Kaunda avatar  avatar

Watchers

 avatar Christopher Seven Phiri avatar

geneveev's Issues

Preserve order of fields when generating

Currently, when generating the schemas the order of the generated fields changes on each run since we are using and iterating through a map[string]string to store the fields parsed from the Go struct. Ideally we need to preserve the order of the fields to avoid confusion about the fields generated, especially if a user is progressively enhancing validation rules and regenerating the schemas in their project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.