Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tiziano88/elm-protobuf
protobuf plugin for elm
https://github.com/tiziano88/elm-protobuf
definition elm grpc json protobuf protocol-buffers rpc serialization
Last synced: 8 days ago
JSON representation
protobuf plugin for elm
- Host: GitHub
- URL: https://github.com/tiziano88/elm-protobuf
- Owner: tiziano88
- License: mit
- Created: 2016-02-08T10:16:11.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-11-14T03:55:36.000Z (almost 2 years ago)
- Last Synced: 2024-10-01T09:19:46.904Z (about 1 month ago)
- Topics: definition, elm, grpc, json, protobuf, protocol-buffers, rpc, serialization
- Language: Elm
- Homepage: https://package.elm-lang.org/packages/tiziano88/elm-protobuf/latest/
- Size: 207 KB
- Stars: 94
- Watchers: 5
- Forks: 28
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-grpc - elm-protobuf - Protoc plugin generating elm code from proto definitions (Language-Specific / Elm)
README
# elm-protobuf
[![Build Status](https://travis-ci.org/tiziano88/elm-protobuf.svg?branch=master)](https://travis-ci.org/tiziano88/elm-protobuf)
[![Go Report Card](https://goreportcard.com/badge/github.com/tiziano88/elm-protobuf)](https://goreportcard.com/report/github.com/tiziano88/elm-protobuf)[Join #elm-protobuf on Slack](https://elmlang.slack.com/messages/elm-protobuf/details/)
Experimental protobuf plugin generating elm code to decode/encode [Proto3/JSON](https://developers.google.com/protocol-buffers/docs/proto3#json) from proto definitions.
The plugin itself is written in Go, and it requires the base `protoc` protobuf
compiler to be installed on the system.For a sample generated output file, see
[Repeated.elm](https://github.com/tiziano88/elm-protobuf/blob/master/protoc-gen-elm/go_tests/testdata/repeated/expected_output/Repeated.elm).## Supported features
- [x] `double`/`float` fields
- [x]
`int32`/`int64`/`uint32`/`uint64`/`sint32`/`sint64`/`fixed32`/`fixed64`/`sfixed32`/`sfixed64`
fields
- [x] `bool` fields
- [x] `string` fields
- [ ] `bytes` fields
- [x] message fields
- [x] enum fields
- [x] imports
- [x] nested types
- [ ] `Any` type
- [x] `Timestamp` type
- [ ] `Duration` type
- [ ] `Struct` type
- [x] wrapper types
- [ ] `FieldMask` type
- [ ] `ListValue` type
- [ ] `Value` type
- [ ] `NullValue` type
- [x] `oneof`
- [ ] `map`
- [ ] packages
- [ ] options## How to install
### Release
The simplest way to install the plugin is to download a pre-compiled binary from
https://github.com/tiziano88/elm-protobuf/releases , then unpack it and copy or
move the `protoc-gen-elm` binary somewhere in your `$PATH`.### From source
- Make sure that you have a Go environment correctly set up, and that
`$GOPATH/bin` is included in your `$PATH`. See
https://golang.org/doc/install for info.- Install a recent `protoc` compiler version from
https://github.com/google/protobuf (it must have support for `proto3`
format).- Obtain the `protoc-gen-elm` binary using `go get`:
```
go get github.com/tiziano88/elm-protobuf/protoc-gen-elm
```## How to run
Run the `protoc` compiler specifying the `--elm_out` flag:
`protoc --elm_out=. *.proto`
`protoc` will automatically detect the `protoc-gen-elm` binary from your `$PATH`
and use it to generate the output elm code.Then, in your project, add a dependency on the runtime library:
`elm install tiziano88/elm-protobuf`
## References
https://developers.google.com/protocol-buffers/
https://developers.google.com/protocol-buffers/docs/proto3#json
https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.compiler.plugin.pb
https://github.com/google/protobuf/wiki/Third-Party-Add-ons