Skip to content
Elm Go Shell Nix
Branch: master
Clone or download
EdSchouten and tiziano88 Remove hardcoded list of tests from update_expected_output. (#27)
The map_entry test is currently missing from this list, meaning the
script fails to sync some of the files. Instead of extending that list,
simply iterate over all of the directories that are present.
Latest commit b76b05c Apr 9, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
protoc-gen-elm Add a useless declaration to every output file. (#25) Apr 9, 2019
src PR feedback Jan 29, 2019
tests Add a useless declaration to every output file. (#25) Apr 9, 2019
.gitignore release script Nov 20, 2016
.travis.yml travis path fix Jan 29, 2019
LICENSE Initial commit Feb 8, 2016
README.md
default.nix go version Aug 18, 2016
elm.json
install
install_protobuf Use local protoc May 25, 2017
package-lock.json Migrate to elm 0.19 Sep 12, 2018
release Disable cgo Sep 17, 2018
run_elm_tests Migrate to elm 0.19 Sep 12, 2018
run_tests Migrate to elm 0.19 Sep 12, 2018
update_expected_output Remove hardcoded list of tests from update_expected_output. (#27) Apr 9, 2019

README.md

elm-protobuf

Build Status Go Report Card

Join #elm-protobuf on Slack

Experimental protobuf plugin generating elm code to decode/encode 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.

Supported features

  • double/float fields
  • int32/int64/uint32/uint64/sint32/sint64/fixed32/fixed64/sfixed32/sfixed64 fields
  • bool fields
  • string fields
  • bytes fields
  • message fields
  • enum fields
  • imports
  • nested types
  • Any type
  • Timestamp type
  • Duration type
  • Struct type
  • wrapper types
  • FieldMask type
  • ListValue type
  • Value type
  • NullValue type
  • 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

You can’t perform that action at this time.