Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
jleben committed Feb 7, 2020
1 parent 1dac0cd commit 9599c32
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,41 @@ Steps:
cd build
cmake ..
make

## Usage

protobuf-spec-comparator dir1 file1.proto dir2 file2.proto type-name
protobuf-spec-comparator dir1 file1.proto dir2 file2.proto type-name [--binary]

The program takes 5 arguments:

The program takes 5 parameters:
- dir1: A directory containing .proto files
- file1.proto: The relative path of a .proto file in dir1
- dir2 and file2.proto: The same as above for another version to compare.
- type-name: The name of a message or enum defined in file1.proto and file2.proto

The definition of a message or enum type-name in file1.proto and file2.proto is compared as detailed below.
You can add the following options:

- `--binary`: Report compatibility of the binary serialization as opposed to the JSON serialization or similar. See below for details.

### Behavior

The definition of a message or enum `type-name` in file1.proto and file2.proto is compared as detailed in the following sections.

If type-name is just ".", then all the messages and enums in file1.proto and file2.proto are compared.
Added and removed messages and enums are reported.

### Message comparison

Message fields are matched by name (a binary comparison mode will be added where fields are matched by ID number).
Message fields are matched by name (default) or by number (when using `--binary`).

Fields present in file1 and missing in file2 are reported as removed, and vice-versa for added fields.
Any changes in matching fields are reported.
If matching fields both have an enum or message type, then those enums and message types are also compared.

If two matching fields both have an enum or message type, then those enums and message types are also compared.

### Enum comparison

Enum types are compared as follows.
Enum values are matched by name (a binary comparison mode will be added where values are matched by ID number).

Values present in file1 and missing in file2 are reported as removed, and vice-versa for added fields.
Any changes in maching enum values are reported.


0 comments on commit 9599c32

Please sign in to comment.