Skip to content

Commit

Permalink
Add documentation for keep_unknown_fields option. Closes #22.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahamez committed Oct 31, 2020
1 parent a9109e4 commit 646cc30
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,23 @@ You must always use `unknown_fields/1` as the name of the field (e.g. `__uf__`)

When you encode a message that contains unknown fields, they will be reencoded in the serialized output.

Finally, you can deactivate the support of unknown fields by setting the `:keep_unknown_fields` option to `false`:
```elixir
defmodule Baz do
use Protox,
schema: """
syntax = "proto3";
message Sub {
int32 a = 1;
string b = 2;
}
""",
keep_unknown_fields: false
end
```
Note that protox will still correctly parse unknown fields, they just won't be added to the structure and you won't be able to access them.

## Unsupported features

* Protobuf 3 JSON mapping
Expand Down

0 comments on commit 646cc30

Please sign in to comment.