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

https://github.com/cybozu/protobuf

Normalization and validation system for Protocol Buffers
https://github.com/cybozu/protobuf

normalization protocol-buffers validation

Last synced: 6 months ago
JSON representation

Normalization and validation system for Protocol Buffers

Awesome Lists containing this project

README

          

# Cybozu Public Protocol Buffers Schema

This repository contains public Protocol Buffer files and related tools from Cybozu.

This repository forms a [Buf module][module] to publish protobuf files on [BSR][BSR].
You can import packages in this repository by adding the following lines to `buf.yaml`.

```yaml
version: v1
deps:
- buf.build/cybozu/protobuf
```

If you are not familiar with `buf`, read https://docs.buf.build/manuals/cli/overview

## `cybozu.validate`

This protobuf package provides custom options to normalize and validate messages.
Read [examples/validation.proto](examples/validation.proto) for example usage.

You can get the code generator for Go as follows:

```console
$ go install github.com/cybozu/protobuf/cmd/protoc-gen-go-cybozu-validate@latest
```

or download prebuilt binaries from [Releases](https://github.com/cybozu/protobuf/releases/latest).

The following is an example `buf.gen.yaml` to generate validation code:

```yaml
version: v1
plugins:
- plugin: go
out: .
opt: paths=source_relative
- plugin: go-cybozu-validate
out: .
opt: paths=source_relative
```

## API documentation

Visit https://buf.build/cybozu/protobuf

## Versioning and backward-compatibility

We keep backward-compatibility of Protocol Buffers files.
When we want to add breaking changes to Protocol Buffers files, we create
a different package like `cybozu.foo.v2` not to break the current package.

However, the generated code in this repository may not be backward compatible.
For example, Go code generated by `protoc-gen-go` may not be always backward compatible.

So, we use a [semver](https://semver.org/) with major version zero (0.y.z) to
tag this repository to declare the generated code may bring breaking changes.

### For developers

Running `make create-tag` creates a new tag and push it to GitHub automatically.
The rest of the release process will be done by GitHub Actions.

## License

All code in this repository is licensed under the Apache License Version 2.0.
Read [LICENSE](LICENSE) for terms and conditions.

[module]: https://docs.buf.build/bsr/overview#modules
[BSR]: https://docs.buf.build/bsr/introduction