Let's say you have a proto defined as the following:

syntax = "proto3";

package shelley.messages.zoo;

option java_multiple_files = true;
option java_package = "com.shelley.grpc.messages.zoo";


message Zoo {
    repeated Cat cats = 1;
}


.......

Let's say cat looks like this:


message Cat {

    google.protobuf.StringValue name = 1

    Decimal age = 2;

}


If I want to reduce the amount of data in Zoo such that sample data only 
contains `Cat` with only the name field, how do I do that?


Example:

A sample Zoo object will look like this:

{

    Cat: [{

        name = "sam";

    },

    {

        name = "hester";

    }]

}


I'm trying to do this with one field mask:


FieldMask zoo_mask = FieldMask.newBuilder()
        .addPaths(*"cats**"*)

        .build();


Zoo getMaskedZoo(FieldMask mask, Zoo zoo) {
    Zoo.Builder zooDest = Zoo.newBuilder();

    FieldMaskUtil.merge(zoo_mask, zoo, zooDest);
    *return zooDest.build();*
}


^^How do I make it so that only the name displays for each `Cat`?

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To post to this group, send email to grpc-io@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/69fdd497-5462-4e33-9989-5ef3410b2b5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to