Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/6543/xyaml

Mirror of eXtend YAML
https://github.com/6543/xyaml

golang golang-library lib library mirror yaml yaml-parser

Last synced: 19 days ago
JSON representation

Mirror of eXtend YAML

Awesome Lists containing this project

README

        

# eXtend YAML

[![Tests](https://ci.codeberg.org/api/badges/6543/xyaml/status.svg)](https://ci.codeberg.org/6543/xyaml)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![GoDoc](https://godoc.org/codeberg.org/6543/xyaml?status.svg)](https://godoc.org/codeberg.org/6543/xyaml)
[![Go Report Card](https://goreportcard.com/badge/codeberg.org/6543/xyaml)](https://goreportcard.com/report/codeberg.org/6543/xyaml)


Get it on Codeberg

is a library to extend [`gopkg.in/yaml.v3`](https://github.com/go-yaml/yaml/tree/v3)
to allow merging [sequences](https://github.com/yaml/yaml/issues/48)

## Features

- [x] merge sequences
- [x] single alias
- [x] array of alias

## How to use

`go get codeberg.org/6543/xyaml`

and just replace your

```go
err := yaml.Unmarshal(in, out)
```

with

```go
err := xyaml.Unmarshal(in, out)
```

## Examples

### merge sequences

```yml
array1: &my_array_alias
- foo
- bar

array2:
- <<: *my_array_alias
- NEW1
- <<: [*my_array_alias, *my_array_alias]
```

will be interpreted as:

```yml
array1:
- foo
- bar

array2:
- foo
- bar
- NEW1
- foo
- bar
- foo
- bar
```