Skip to content

document corner-cases with map_by schemas #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,23 @@ Then you can access the extension fields in Clojure:
=> {:max 100.0 :min -100.0}
```

Note that you do not have to specify the _key_ in a map which uses `map_by`; clojure-protobuf will just fill it out for you:

```clojure
(protobuf Photo :id 7 :path "/example/path" :tags {4 {:x_coord 100}})
=> {:id 7, :path "/example/path", :tags {4 {:person-id 4, :x-coord 100}}}
```

Specifying different values will cause clojure-protobuf to override the outer one:

```clojure
(protobuf Photo :id 7 :path "/example/path" :tags {4 {:person_id 50 :x_coord 100}})
=> {:id 7, :path "/example/path", :tags {50 {:person-id 50, :x-coord 100}}}
```

Because of this behaviour, valid input to `(protobuf-dump (protobuf P ...))` can be different from the output of `(protobuf-load P ...)`.


## Getting Help

If you have any questions or need help, you can find us on IRC in [#flatland](irc://irc.freenode.net/#flatland).