All Projects → nilslice → Protolock

nilslice / Protolock

Licence: bsd-3-clause
Protocol Buffer companion tool. Track your .proto files and prevent changes to messages and services which impact API compatibility.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Protolock

Protodot
transforming your .proto files into .dot files (and .svg, .png if you happen to have graphviz installed)
Stars: ✭ 107 (-72.84%)
Mutual labels:  cli, protobuf, protocol-buffers, protoc
Protobuf Dynamic
Protocol Buffers Dynamic Schema - create protobuf schemas programmatically
Stars: ✭ 186 (-52.79%)
Mutual labels:  protobuf, protocol-buffers, protoc
Pb And K
Kotlin Code Generator and Runtime for Protocol Buffers
Stars: ✭ 137 (-65.23%)
Mutual labels:  protobuf, protocol-buffers, protoc
Rules protobuf
Bazel rules for building protocol buffers and gRPC services (java, c++, go, ...)
Stars: ✭ 206 (-47.72%)
Mutual labels:  protobuf, protocol-buffers, protoc
Protobuf Swift
Google ProtocolBuffers for Apple Swift
Stars: ✭ 925 (+134.77%)
Mutual labels:  protobuf, protocol-buffers, protoc
Protoc Jar
Protocol Buffers protobuf compiler - multi-platform executable protoc JAR and API
Stars: ✭ 103 (-73.86%)
Mutual labels:  protobuf, protocol-buffers, protoc
Protoc Jar Maven Plugin
Protocol Buffers protobuf maven plugin - based on protoc-jar multi-platform executable protoc JAR
Stars: ✭ 177 (-55.08%)
Mutual labels:  protobuf, protocol-buffers, protoc
makego
Makefile setup for our Golang projects.
Stars: ✭ 65 (-83.5%)
Mutual labels:  protobuf, protocol-buffers, protoc
Stup
Daily notes in the terminal 🐧
Stars: ✭ 340 (-13.71%)
Mutual labels:  productivity, cli, tools
Namecheck
Check your name idea availability with CLI
Stars: ✭ 19 (-95.18%)
Mutual labels:  productivity, cli, tools
Prototool
Your Swiss Army Knife for Protocol Buffers
Stars: ✭ 4,932 (+1151.78%)
Mutual labels:  protobuf, protocol-buffers, protoc
protocell
Conjures up convenient OCaml types and serialization functions based on protobuf definition files
Stars: ✭ 18 (-95.43%)
Mutual labels:  protobuf, protocol-buffers, protoc
Protobuf
A pure Elixir implementation of Google Protobuf
Stars: ✭ 442 (+12.18%)
Mutual labels:  protobuf, protocol-buffers, protoc
Protobuf
Protocol Buffers - Google's data interchange format
Stars: ✭ 52,305 (+13175.38%)
Mutual labels:  protobuf, protocol-buffers, protoc
Buf
A new way of working with Protocol Buffers.
Stars: ✭ 3,328 (+744.67%)
Mutual labels:  protocol-buffers, protoc, protobuf
Protolint
A pluggable linter and fixer to enforce Protocol Buffer style and conventions.
Stars: ✭ 142 (-63.96%)
Mutual labels:  cli, protobuf, protocol-buffers
protobuf-d
Protocol Buffers Compiler Plugin and Support Library for D
Stars: ✭ 32 (-91.88%)
Mutual labels:  protobuf, protocol-buffers, protoc
protopatch
protoc-gen-go patch utility
Stars: ✭ 58 (-85.28%)
Mutual labels:  protobuf, protocol-buffers, protoc
Fw
workspace productivity booster
Stars: ✭ 269 (-31.73%)
Mutual labels:  productivity, cli
protoc-gen-kit
Protoc compiler for Go kit code
Stars: ✭ 17 (-95.69%)
Mutual labels:  protobuf, protoc

protolock

Track your .proto files and prevent changes to messages and services which impact API compatibility.

CircleCI GoDoc Docker

Why

Ever accidentally break your API compatibility while you're busy fixing problems? You may have forgotten to reserve the field number of a message or you re-ordered fields after removing a property. Maybe a new team member was not familiar with the backward-compatibility of Protocol Buffers and made an easy mistake.

protolock attempts to help prevent this from happening.

Overview

  1. Initialize your repository:

     $ protolock init
     # creates a `proto.lock` file
    
  2. Add changes to .proto messages or services, verify no breaking changes made:

     $ protolock status
     CONFLICT: "Channel" is missing ID: 108, which had been reserved [path/to/file.proto]
     CONFLICT: "Channel" is missing ID: 109, which had been reserved [path/to/file.proto]
    
  3. Commit a new state of your .protos (rewrites proto.lock if no warnings):

     $ protolock commit
     # optionally provide --force flag to disregard warnings
    
  4. Integrate into your protobuf compilation step:

     $ protolock status && protoc -I ...
    

In all, prevent yourself from compiling your protobufs and generating code if breaking changes have been made.

Recommended: commit the output proto.lock file into your version control system

Install

If you have Go installed, you can install protolock by running:

go get -u github.com/nilslice/protolock/...

Otherwise, download a pre-built binary for Windows, macOS, or Linux from the latest release page.

Usage

protolock <command> [options]

Commands:
	-h, --help, help	display the usage information for protolock
	init			initialize a proto.lock file from current tree
	status			check for breaking changes and report conflicts
	commit			rewrite proto.lock file with current tree if no conflicts (--force to override)

Options:
	--strict [true]		enable strict mode and enforce all built-in rules
	--debug	[false]		enable debug mode and output debug messages
	--ignore 		comma-separated list of filepaths to ignore
	--force [false]		forces commit to rewrite proto.lock file and disregards warnings
	--plugins 		comma-separated list of executable protolock plugin names
	--lockdir [.]		directory of proto.lock file
	--protoroot [.]		root of directory tree containing proto files
	--uptodate [false]	enforce that proto.lock file is up-to-date with proto files

Related Projects & Users

Rules Enforced

No Using Reserved Fields

Compares the current vs. updated Protolock definitions and will return a list of warnings if any message's previously reserved fields or IDs are now being used as part of the same message.

No Removing Reserved Fields

Compares the current vs. updated Protolock definitions and will return a list of warnings if any reserved field has been removed.

Note: This rule is not enforced when strict mode is disabled.

No Changing Field IDs

Compares the current vs. updated Protolock definitions and will return a list of warnings if any field ID number has been changed.

No Changing Field Types

Compares the current vs. updated Protolock definitions and will return a list of warnings if any field type has been changed.

No Changing Field Names

Compares the current vs. updated Protolock definitions and will return a list of warnings if any message's previous fields have been renamed.

Note: This rule is not enforced when strict mode is disabled.

No Removing Fields Without Reserve

Compares the current vs. updated Protolock definitions and will return a list of warnings if any field has been removed without a corresponding reservation of that field name or ID.

No Removing RPCs

Compares the current vs. updated Protolock definitions and will return a list of warnings if any RPCs provided by a Service have been removed.

Note: This rule is not enforced when strict mode is disabled.

No Changing RPC Signature

Compares the current vs. updated Protolock definitions and will return a list of warnings if any RPC signature has been changed while using the same name.


Docker

docker pull nilslice/protolock:latest
docker run -v $(pwd):/protolock -w /protolock nilslice/protolock init

Plugins

The default rules enforced by protolock may not cover everything you want to do. If you have custom checks you'd like run on your .proto files, create a plugin, and have protolock run it and report your warnings. Read the wiki to learn more about creating and using plugins.


Contributing

Please feel free to make pull requests with better support for various rules, optimized code and overall tests. Filing an issue when you encounter a bug or any unexpected behavior is very much appreciated.

For current issues, see: open issues


Acknowledgement

Thank you to Ernest Micklei for his work on the excellent parser heavily relied upon by this tool and many more: https://github.com/emicklei/proto

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].