All Projects → PrasadG193 → Yaml2go

PrasadG193 / Yaml2go

Licence: mit
Converts YAML specs into Go Lang type definitions

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Labels

Projects that are alternatives of or similar to Yaml2go

Cv Boilerplate
Programmatic generation of high-quality CVs
Stars: ✭ 967 (+1596.49%)
Mutual labels:  yaml
Jsonj
A fluent Java API for manipulating json data structures
Stars: ✭ 42 (-26.32%)
Mutual labels:  yaml
Ansible Config encoder filters
Ansible role used to deliver the Config Encoder Filters.
Stars: ✭ 48 (-15.79%)
Mutual labels:  yaml
Configr
Implements the JSON, INI, YAML and TOML parser, for R setting and writing of configuration file.
Stars: ✭ 38 (-33.33%)
Mutual labels:  yaml
Fast yaml
Fast YAML native library for Erlang / Elixir
Stars: ✭ 40 (-29.82%)
Mutual labels:  yaml
I18nplugin
Intellij idea i18next support plugin
Stars: ✭ 43 (-24.56%)
Mutual labels:  yaml
Systemdclash
Clash 以 systemd 服务的方式开机自启
Stars: ✭ 31 (-45.61%)
Mutual labels:  yaml
Communityscrapers
This is a public repository containing scrapers created by the Stash Community.
Stars: ✭ 51 (-10.53%)
Mutual labels:  yaml
Home Assistant Config
My Home Assistant configuration
Stars: ✭ 41 (-28.07%)
Mutual labels:  yaml
Shon
A simple tool to convert json or yaml into a shell-compliant data structure.
Stars: ✭ 47 (-17.54%)
Mutual labels:  yaml
Hyperpotamus
🥋 YAML/JSON automation scripting 🤺
Stars: ✭ 38 (-33.33%)
Mutual labels:  yaml
Emrichen
A Template engine for YAML & JSON
Stars: ✭ 40 (-29.82%)
Mutual labels:  yaml
Zaml
The Final Form of configuration files
Stars: ✭ 45 (-21.05%)
Mutual labels:  yaml
Kafka Specs
Tool to ease and automate Apache Kafka cluster configuration management
Stars: ✭ 36 (-36.84%)
Mutual labels:  yaml
Resticprofile
Configuration profiles for restic backup
Stars: ✭ 48 (-15.79%)
Mutual labels:  yaml
Chatterbot Corpus
A multilingual dialog corpus
Stars: ✭ 964 (+1591.23%)
Mutual labels:  yaml
Bashful
Use a yaml file to stitch together commands and bash snippits and run them with a bit of style. Why? Because your bash script should be quiet and shy-like (...and not such a loud mouth).
Stars: ✭ 1,018 (+1685.96%)
Mutual labels:  yaml
Feedr
Use feedr to fetch the data from a remote url, respect its caching, and parse its data. Despite its name, it's not just for feed data but also for all data that you can feed into it (including binary data).
Stars: ✭ 56 (-1.75%)
Mutual labels:  yaml
Yglu
Yglu ᕄ !? - YAML glue for structural templating and processing
Stars: ✭ 51 (-10.53%)
Mutual labels:  yaml
Legivel
F# Yaml 1.2 parser
Stars: ✭ 47 (-17.54%)
Mutual labels:  yaml

yaml2go

Build Status

Converts YAML specs into Go type definitions

https://github.com/PrasadG193/yaml2go

Installation

Binary Installation

Pre-compiled binaries are available on the releases page. You can download the correct binary depending on your system arch, put it into $PATH and hit yaml2go help

Install From Source

Build binary using go build

$ go get -u github.com/PrasadG193/yaml2go
$ go build -o yaml2go github.com/PrasadG193/yaml2go/cmd/cli

Usage

Show help

yaml2go --help
yaml2go converts YAML specs to Go type definitions

Usage:
    yaml2go < /path/to/yamlspec.yaml

Examples:
    yaml2go < test/example1.yaml
    yaml2go < test/example1.yaml > example1.go

Convert yaml spec to Go struct

$ yaml2go < example.yaml

e.g

$ cat example1.yaml
kind: test
metadata:
  name: cluster
  nullfield:
  nestedstruct:
  - nested:
      underscore_field: value
      field1:
      - 44.5
      - 43.6
      field2:
      - true
      - false
    nested2:
      - nested3:
          field1:
          - 44
          - 43
          fieldt:
          - true
          - false
          field3: value
abc:
  - def:
    - black
    - white
array1:
  - "string1"
  - "string2"
array2:
  - 2
  - 6
array3:
  - 3.14
  - 5.12
is_underscore: true
$ GOPATH/bin/yaml2go < example1.yaml
// Yaml2Go
type Yaml2Go struct {
        Kind         string    `yaml:"kind"`
        Metadata     Metadata  `yaml:"metadata"`
        Abc          []Abc     `yaml:"abc"`
        Array1       []string  `yaml:"array1"`
        Array2       []int     `yaml:"array2"`
        Array3       []float64 `yaml:"array3"`
        IsUnderscore bool      `yaml:"is_underscore"`
}

// Metadata
type Metadata struct {
        Name         string         `yaml:"name"`
        Nullfield    interface{}    `yaml:"nullfield"`
        Nestedstruct []Nestedstruct `yaml:"nestedstruct"`
}

// Nested3
type Nested3 struct {
        Field1 []int  `yaml:"field1"`
        Fieldt []bool `yaml:"fieldt"`
        Field3 string `yaml:"field3"`
}

// Abc
type Abc struct {
        Def []string `yaml:"def"`
}

// Nestedstruct
type Nestedstruct struct {
        Nested  Nested    `yaml:"nested"`
        Nested2 []Nested2 `yaml:"nested2"`
}

// Nested
type Nested struct {
        UnderscoreField string    `yaml:"underscore_field"`
        Field1          []float64 `yaml:"field1"`
        Field2          []bool    `yaml:"field2"`
}

// Nested2
type Nested2 struct {
        Nested3 Nested3 `yaml:"nested3"`
}

Contributing

We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:

  • Reporting a bug
  • Discussing the current state of the code
  • Submitting a fix
  • Proposing new features

Credits

The Go Gopher is originally by Renee French

This artwork is borrowed from an awesome artwork collection by Egon Elbre

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].