Native Data Asset Type >= 500 throws error during deserialization.
mnouh opened this issue · 1 comments
See below Bid Request that uses data type of 500, which is exchange specific under the OpenRTB native specification. During deserialization, the below exception is being thrown:
com.google.protobuf.UninitializedMessageException: Message missing required fields: type at com.google.protobuf.AbstractMessage$Builder.newUninitializedMessageException(AbstractMessage.java:372) ~[?:?] at com.google.openrtb.OpenRtb$NativeRequest$Asset$Data$Builder.build(OpenRtb.java) ~[?:?] at com.google.openrtb.OpenRtb$NativeRequest$Asset$Builder.setData(OpenRtb.java) ~[?:?] at com.google.openrtb.json.OpenRtbNativeJsonReader.readReqAssetField(OpenRtbNativeJsonReader.java:210) ~[?:?] at com.google.openrtb.json.OpenRtbNativeJsonReader.readReqAsset(OpenRtbNativeJsonReader.java:185) ~[?:?] at com.google.openrtb.json.OpenRtbNativeJsonReader.readNativeRequestField(OpenRtbNativeJsonReader.java:151) ~[?:?] at com.google.openrtb.json.OpenRtbNativeJsonReader.readNativeRequest(OpenRtbNativeJsonReader.java:113) ~[?:?] at com.google.openrtb.json.OpenRtbJsonReader.readNativeField(OpenRtbJsonReader.java:334) ~[?:?] at com.google.openrtb.json.OpenRtbJsonReader.readNative(OpenRtbJsonReader.java:320) ~[?:?] at com.google.openrtb.json.OpenRtbJsonReader.readImpField(OpenRtbJsonReader.java:273) ~[?:?] at com.google.openrtb.json.OpenRtbJsonReader.readImp(OpenRtbJsonReader.java:251) ~[?:?] at com.google.openrtb.json.OpenRtbJsonReader.readBidRequestField(OpenRtbJsonReader.java:157) ~[?:?] at com.google.openrtb.json.OpenRtbJsonReader.readBidRequest(OpenRtbJsonReader.java:143) ~[?:?] at com.google.openrtb.json.OpenRtbJsonReader.readBidRequest(OpenRtbJsonReader.java:124) ~[?:?]
Bid Request:
{ "id": "94d8a111-c232-4b38-a4ac-f6aa213e4a80", "imp": [ { "secure": 0, "bidfloor": 1.00, "native": { "request": { "native": { "plcmtcnt": 1, "assets": [ { "id": 1, "required": 1, "title": { "len": 140 } }, { "id": 3, "required": 0, "img": { "hmin": 48, "wmin": 48, "type": 2 } }, { "id": 11, "required": 0, "data": { "len": 2000, "type": 500 } }, { "id": 2, "required": 0, "img": { "hmin": 0, "wmin": 0, "type": 1 } } ], "adunit": 2, "ver": "1.1", "layout": 3 } } }, "id": "1" } ] }
Unfortunately this is "working as intended": strong-typed enums are one important design tradeoff of this proto, so you get development conveniences like compile-time checking or code completion for fields like this (at least then the proto is compiled for static-typed languages), but there's no support for extended values. Unless of course you fork the proto and declare the additional values for extensions you want to support. Notice that such fork may need to be on a per-exchange basis, since there's no mechanism to prevent different exchanges to use the same number for their extensions.
My personal opinion is that this extension mechanism is a very bad idea, which I have expressed a few times to the OpenRTB committee; DoubleClick Ad Exchange makes no use of this ever, even though we have lots of custom values that can't be mapped cleanly to many of these enum-typed fields. It's much cleaner to use a proper extension with ext.*
nodes when this is necessary. </rant>