model_message convenience & required NDB fields

5 views
Skip to first unread message

Dewey Gaedcke

unread,
Apr 9, 2016, 4:39:46 PM4/9/16
to Ferris Framework
I love "model_message" and "compose" for very quickly creating message classes.....it's awesome.

But I'd like to be able to reuse my message Types across several different endpoints, with different payload requirements, and the "required" attribute is a problem here

....the ObjC message names on the IOS side are long, confusing and messy and so I'd like not have 30 different message types....."compose" has allowed me to shrink the list considerably......

And I want to keep the "required" attribute on my ndb schema for PERSISTENCE of certain fields, but I'd like to be able to disabled the required attribute for certain fields inside of a "compose"d message....

Right now, when I try:
PersonLocalRowMsg.field_by_name('createReason').required=False
I'm getting a  "message fields are read only" error.....

Any tips on how to get around this??

Jonathan Parrott

unread,
Apr 10, 2016, 6:38:16 PM4/10/16
to Dewey Gaedcke, Ferris Framework
Unfortunately there's no way to do this at the protobuf level. Messages are immutable and must be so that clients can be reliability generated.

You can make the field in the protobuf message optional and just enforce the required logic at your handler level.
Reply all
Reply to author
Forward
0 new messages