Skip to content

Documentation on defining an encoder in terms of its mapper? #22

@reify-tanner-stirrat

Description

@reify-tanner-stirrat

Hi all!

I've got an issue where I've got some proto that looks like this:

message ObjectReference {
  string object_type = 1;
  string object_id = 2;
}

I want to define a decoder on this object that moves it to a map so that I can do decoding on the object_id if the object_type matches a condition. The docs show how you might define an encoder/decoder pair where the non-proto side is a scalar value, but it isn't clear to me what to do if it's a map.

Do I define a separate mapper so that I can return a proto-map within the encoder? Does it work to define a decoder in terms of the mapper it's being defined on? Is there another better approach that I'm not thinking of? I'd be happy to contribute the answer to the readme.

EDIT:

I suppose one answer is that this is an inappropriate place to do this sort of transformation, and it'd be better to do it on the clojure constructs that we're moving into proto before it hits the mapper.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions