pronto icon indicating copy to clipboard operation
pronto copied to clipboard

optional enums are always set with default value

Open mping-exo opened this issue 1 year ago • 0 comments

Consider the following proto definition:

enum JobStatus {
    JOBSTATUS_UNKNOWN = 0;
    JOBSTATUS_NEW = 1;
}

message Request {
    optional JobStatus status = 1;
    optional string str = 2;
}

And the following mapping:


(p/defmapper xxx [Proto$Request])

(p/proto->proto-map xxx (-> (Proto$Request/newBuilder)
                            (.build)))

Since the field is optional, one would expect the resulting map to have the optional-but-not-present fields to be nil; however that doesn't happen:

 {:status :JOBSTATUS_UNKNOWN, :str ""}

mping-exo avatar Apr 04 '24 21:04 mping-exo