Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/hanneskimara/cddlc

WIP: Parser and Code Generator for the Concise Data Definition Language (CDDL)
https://github.com/hanneskimara/cddlc

cbor cddl codegen golang parser rfc8610 validation

Last synced: 2 months ago
JSON representation

WIP: Parser and Code Generator for the Concise Data Definition Language (CDDL)

Awesome Lists containing this project

README

        

# CDDL
[![Build status](https://github.com/HannesKimara/cddlc/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/HannesKimara/cddlc/actions/workflows/go.yml)
[![GoDoc](https://pkg.go.dev/badge/github.com/HannesKimara/cddlc?utm_source=godoc)](https://pkg.go.dev/github.com/HannesKimara/cddlc)

Golang implementation for Concise Data Definition Language (CDDL). CDDL is an [IETF standard](https://www.rfc-editor.org/rfc/rfc8610) whose main goal is to provide an easy and unambiguous way to express structures for protocol messages and data formats that use CBOR or JSON.

> **Warning**

This repository is still in active development and may introduce breaking changes. Do not use in production

## Installation
### Go library

``` sh
go get -u github.com/HannesKimara/cddlc
```

### cddlc tool
```sh
go install github.com/HannesKimara/cddlc/cmd/cddlc@latest
```

## Getting Started

![cddlc demo](./docs/static/cddlc-demo.gif)

To get started using the parser library visit the [docs](https://pkg.go.dev/github.com/HannesKimara/cddlc)

## Supported features
| CDDL | Parser | Code Generator |
|------|--------|----------------|
| identifiers
(`basic`, `hyphen-separated`, *`weird..ones` ...) | ☑ | ☑* |
| primitives
(`bool`, `false`, `true`, `tstr`, `text`, `"text_literal"`, `float`, `float16`, `float32`, `float64`, `uint`, `int`, `nint`, `bstr`, `bytes`, `null/nil`) | ☑ | ☑ |
| occurrence operators
(`*`, `+`, `?`) | ☑ | ☐ |
| choice operators
(`/`, `//`) | ☑ | ☐ |
| composition operators
(`~`) | ☑ | ☐ |
| comparable control operators
(`.lt`, `.le`, `.gt`, `.ge`, `.eq`, `.ne`) | ☑ | ☐ |
| constraint control operators
(`.size`, `.regexp`) | ☑ | ☐ |
| collections
(`groups ()`, `arrays []`, `structs {}`) | ☑ | ☐ |

> **Note**

`*` means that the cddl construct may not be fully supported in a particular context such as identifer translation during code generation.

## License

This project is licensed under the Apache-2.0 license. Please see the [LICENSE](LICENSE) file for more details.