Git Product home page Git Product logo

openrtb's Introduction

Google OpenRTB Libraries

This library supports the OpenRTB specification, providing bindings for all protobuf-supported languages, and additional support for Java such as JSON serialization and validation.

See our wiki to get started! Use the Github issue tracker for bugs, RFEs or any support. Check the changelog for detailed release notes.

BUILDING NOTES

You need: JDK 8, Maven 3.2, Protocol buffers (protoc) 3.5.1. Building is supported from the command line with Maven and from any IDE that can load Maven projects.

On Eclipse, the latest m2e is recommended but it can't run the code generation step, so you need to run a "mvn install" from the command line after checkout or after any mvn clean.

openrtb's People

Contributors

bundeskanzler4711 avatar donbeave avatar matzi11a avatar opinali avatar suzuken avatar tomill avatar vkorenev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openrtb's Issues

build DSP

where can I learn how to build a DSP?

How can I reject the bid request?

Hello everyone,

I am trying to integrate Smaato advertiser service(http://dspportal.smaato.com/), which uses OpenRTB standards. I want to reject the bid request which contains mime type which my ad doesn't support. For example bid request sends application/javascript (richmedia), but my ad supports only image/jpeg, image/png, image/gif. How can I reject such bid requests?

Thanks

Extension Json Serialization Documentation Lacking

Hi

I am desperately trying to configure the JSON Serialization/deserialization for an extension I wrote such as this:

`message BidResponseErrors {

extend com.google.openrtb.BidResponse{
	repeated string errors = 100;	
}

extensions 100 to 9999;

}`

I am able to Add data to the extension and I can see it using the debugger.
But I cannot figure out how to write the BidResponseErrorsWriter and the BidResponseErrorsReader, how to initialize them and what to write inside.

I am lacking a lot of documentation. So far this is what I have:

The writer:
public class BidResponseErrorsWriter extends OpenRtbJsonExtWriter<BidResponseErrors> { @Override protected void write(BidResponseErrors value, JsonGenerator gen) throws IOException { gen.writeStartArray(); gen.writeEndArray(); } }
The Reader:
public class BidResponseErrorsReader extends OpenRtbJsonExtReader<BidResponseErrors.Builder>{ protected void read(Builder msg, JsonParser par) throws IOException { } }

And the registration:
OpenRtbJsonWriter jsonWriter = OpenRtbJsonFactory.create() .register(new BidResponseErrorsWriter(), BidResponseErrors.class, BidResponse.class) .newWriter();

Needless to say that nothing here works, and the writer method is not invoked.
Any help would be very much appreciated.

Thank You

Yoav

Reading multiple extensions of the same message type with different name

Hello,

I am trying to understand if OpenRtbJsonExtReader is capable of dealing with the case where a message is extended several times with another message with different extension name. This concerns version 0.8.1 of the library. My example is as follows:

I extended OpenRTB like so:

...

// Extended twice with customer Event message using different extension name.
extend com.google.openrtb.BidResponse.SeatBid.Bid { 
  optional Event impression = 188;
  optional Event click = 189;
  ...
}

...

and implemented OpenRtbJsonExtReader<Bid.Builder, Event.Builder> like so:

public class EventExtensionReader extends OpenRtbJsonExtReader<Bid.Builder, Event.Builder> {

    public EventExtensionReader(GeneratedExtension<?, ?> key) {
        super(key);
    }

    @Override
    protected void read(Bid.Builder msg, Event.Builder ext, JsonParser par) throws IOException {
        // Determine if this is a click or impression by checking current parameter name.
        String fieldName = getCurrentName(par);
        Type type = Type.valueOf(getCurrentName(par).toUpperCase());
        switch (type) {
            case IMPRESSION:
                EventUtils.read(ext, type, par);
                // msg.setExtension(MyProto.impression, EventUtils.read(ext, type, par).build());
                return;
            case CLICK:
                EventUtils.read(ext, type, par);
                // msg.setExtension(MyProto.click, EventUtils.read(ext, type, par).build());
                return;
            default:
                break;
        }
        return;
    }

}

The OpenRtbJsonReader for extensions of bids is instantiated like:

    private OpenRtbJsonReader reader = jsonFactory
        .register(new EventExtensionReader(MyProto.click), Bid.Builder.class)
        .register(new EventExtensionReader(MyProto.impression), Bid.Builder.class)
        .newReader();

With the above reader the parsed bid will only contain one event extension only! Further, the name will be "click" but the Event instance will be that of the impression.

The only way to properly de-serialise both extensions is to explicitly set the extension - see commented code - but it seems wrong. Is there something I am missing?

Thanks

/David

Trying out openrtb(tutorial?)

Hi! I'm really interested to try out openrtb. However, I'm not very proficient with Java. Any steps I can follow to setup and running? I have m2e plugin on eclipse.
Also, is openrtb different from google's open bidder?

When enum name is stripped and label is PascalCased (Iab11), this value label conflicts with IAB1_1

mvn clean test

[INFO] Executing tasks

main:
[exec] openrtb.proto:2036:3: When enum name is stripped and label is PascalCased (Iab11), this value label conflicts with IAB1_1
[exec] openrtb.proto:2042:3: When enum name is stripped and label is PascalCased (Iab12), this value label conflicts with IAB1_2
[exec] openrtb.proto:2046:3: When enum name is stripped and label is PascalCased (Iab13), this value label conflicts with IAB1_3
[exec] openrtb.proto:2059:3: When enum name is stripped and label is PascalCased (Iab14), this value label conflicts with IAB1_4
[exec] openrtb.proto:2068:3: When enum name is stripped and label is PascalCased (Iab15), this value label conflicts with IAB1_5
[exec] openrtb.proto:2079:3: When enum name is stripped and label is PascalCased (Iab16), this value label conflicts with IAB1_6
[exec] openrtb.proto:2087:3: When enum name is stripped and label is PascalCased (Iab17), this value label conflicts with IAB1_7
[exec] openrtb.proto:2204:3: When enum name is stripped and label is PascalCased (Iab21), this value label conflicts with IAB2_1
[exec] openrtb.proto:2205:3: When enum name is stripped and label is PascalCased (Iab211), this value label conflicts with IAB2_11
[exec] openrtb.proto:2206:3: When enum name is stripped and label is PascalCased (Iab212), this value label conflicts with IAB2_12
[exec] openrtb.proto:2207:3: When enum name is stripped and label is PascalCased (Iab213), this value label conflicts with IAB2_13
[exec] openrtb.proto:2208:3: When enum name is stripped and label is PascalCased (Iab22), this value label conflicts with IAB2_2
[exec] openrtb.proto:2209:3: When enum name is stripped and label is PascalCased (Iab221), this value label conflicts with IAB2_21
[exec] openrtb.proto:2210:3: When enum name is stripped and label is PascalCased (Iab222), this value label conflicts with IAB2_22
[exec] openrtb.proto:2211:3: When enum name is stripped and label is PascalCased (Iab223), this value label conflicts with IAB2_23
[exec] openrtb.proto:2213:3: When enum name is stripped and label is PascalCased (Iab23), this value label conflicts with IAB2_3
[exec] openrtb.proto:2224:3: When enum name is stripped and label is PascalCased (Iab24), this value label conflicts with IAB2_4
[exec] openrtb.proto:2225:3: When enum name is stripped and label is PascalCased (Iab25), this value label conflicts with IAB2_5
[exec] openrtb.proto:2233:3: When enum name is stripped and label is PascalCased (Iab26), this value label conflicts with IAB2_6

Allow native fields as object

Hi, *!

To allow communication between SSPs and DSPs with either native-as-string or alternatively native-as-object fields, I'd love to have support for these variants:

Bid request:

  • no root-native field, native as request field (String)
  • including root-native field, native as request field (String)
  • no root-native field, native as request_native field (Json-Object) NEW
  • including root-native field, native as request_native field (Json-Object) NEW

Bid response:

  • no root-native field, native as adm field (String)
  • including root-native field, native as adm field (String)
  • no root-native field, native as adm_native field (Json-Object) NEW
  • including root-native field, native as adm_native field (Json-Object) NEW

There are already some methods that can be used. Even the fields request_native and adm_native are currently there.
So: "How hard can it be?" ;-)

Native Data Asset Type >= 500 throws error during deserialization.

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" } ] }

Ignoring unknown bid request extensions in OpenRtbJsonReader

Is there a way to set the OpenRtbJsonReader to ignore unknown RTB extensions in an exchange bid request? I am concerned that if an exchange adds additional extensions to their requests this could lead to exceptions and a halt in bidding if new extension readers/writers aren't created and deployed in time. Also it places additional burden on a DSP using the library to require extension handling for extensions that may not be of interest to them.

Wrong default value for deal auction type.

When invoking the getAt() method on a OpenRtb.BidRequest.Imp.Pmp.Deal object, that doesn't have that 'at' value set - the method defaults to OpenRtb.AuctionType.FIRST_PRICE.

According to the OpenRTB specs, if should default to the BidRequest's auction type: "Optional override of the overall auction type of the bid request".

(Which in turn defaults correctly to OpenRtb.AuctionType.SECOND_PRICE)

Handling 500+ DataAssetType Values

We are receiving messages from a 3rd party which contain DataAssetTypes of 501, 502, etc. The 500+ range is defined in the openrtb spec for "exchange specific usage".

readBidRequests() fails to process messages containing these data types (stacktrace below).

I believe enum's cannot be extended in protobuf. What would be the best way to allow processing of these messages?

com.google.protobuf.UninitializedMessageException: Message missing required fields: type
	at com.google.protobuf.AbstractMessage$Builder.newUninitializedMessageException(AbstractMessage.java:501)
	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:224)
	at com.google.openrtb.json.OpenRtbNativeJsonReader.readReqAsset(OpenRtbNativeJsonReader.java:199)
	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:410)
	at com.google.openrtb.json.OpenRtbJsonReader.readNative(OpenRtbJsonReader.java:396)
	at com.google.openrtb.json.OpenRtbJsonReader.readImpField(OpenRtbJsonReader.java:316)
	at com.google.openrtb.json.OpenRtbJsonReader.readImp(OpenRtbJsonReader.java:294)
	at com.google.openrtb.json.OpenRtbJsonReader.readBidRequestField(OpenRtbJsonReader.java:159)
	at com.google.openrtb.json.OpenRtbJsonReader.readBidRequest(OpenRtbJsonReader.java:145)
	at com.google.openrtb.json.OpenRtbJsonReader.readBidRequest(OpenRtbJsonReader.java:126)

Add builder instance as argument of public parsing methods in OpenRtbJsonReader

For methods like OpenRtbJsonReader#parseBid(JsonParser par) - would it make sense to add the builder instance to the argument list instead of creating the instance inside the method?

I have the use case where bid instances are added as an extension to a bid request's impression(s) - if I could pass an external Bid.Builder instance to the above parsing method I could leverage OpenRtbJsonReader's implementation inside my extension reader's OpenRtbJsonExtReader<Impression.Builder, Bid.Builder>#read(Impression.Builder msg, Bid.Builder ext, JsonParser par) method by just calling OpenRtbJsonReader#parseBid(ext, par).

Cannot find VideoBidResponseProtocol when running example

Hi,

When I try to run the example in wiki,

BidRequest request = BidRequest.newBuilder()
.setId("1")
.addImp(Imp.newBuilder()
.setId("1")
.setBidfloor(4000)
.setVideo(Video.newBuilder()
.setLinearity(VideoLinearity.LINEAR)
.addProtocols(VideoBidResponseProtocol.VAST_3_0)
.setW(640)
.setH(480)))
.build();

I cannot find class VideoBidResponseProtocol

Is it remove from the current build of this project ?

problem parsing json for request that contain 'native' key

Hi,

While trying to add support for open RTB 2.3 I would like to support native adds, I took an example of native ad request from the specification document:

{  
   "id":"80ce30c53c16e6ede735f123ef6e32361bfc7b22",
   "at":1,
   "cur":[  
      "USD"
   ],
   "imp":[  
      {  
         "id":"1",
         "bidfloor":0.03,
         "native":{  
            "request":"...Native Spec request as an encoded string...",
            "ver":"1.0",
            "api":[  
               3
            ],
            "battr":[  
               13,
               14
            ]
         }
      }
   ],
   "site":{  
      "id":"102855"      "cat":[  
         "IAB3-1"
      ],
      "domain":"www.foobar.com",
      "page":"http://www.foobar.com/1234.html ",
      "publisher":{  
         "id":"8953",
         "name":"foobar.com",
         "cat":[  
            "IAB3-1"
         ],
         "domain":"foobar.com"
      }
   },
   "device":{  
      "ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13 
(KHTML, like Gecko) Version/5.1.7 Safari/534.57.2",
      "ip":"123.145.167.10"
   },
   "user":{  
      "id":"55816b39711f9b5acf3b90e313ed29e51665623f"
   }

Reading the message model in openrtb.proto I noticed:

message Native {
      oneof request_oneof {
        // Request payload complying with the Native Ad Specification.
        // Exactly one of {request, request_native} should be used;
        // this is the OpenRTB-compliant field for JSON serialization.
        // [AdX: BidRequest.AdSlot.NativeAdTemplate]
        string request = 1;

        // Request payload complying with the Native Ad Specification.
        // Exactly one of {request, request_native} should be used;
        // this is an alternate field preferred for Protobuf serialization.
        // [AdX: BidRequest.AdSlot.NativeAdTemplate]
        NativeRequest request_native = 50;
      }
      ...
}

I understand that the native object should contain either a string with the field request or the object NativeRequest

But when I run the request I get the error:

com.fasterxml.jackson.core.JsonParseException: Unexpected character ('.' (code 46)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
at [Source: java.io.CharArrayReader@3a9fcbdf; line: 1, column: 2]

From debugging the code I saw the following:
In class OpenRtbJsonReader::protected void readNativeField(JsonParser par, Native.Builder nativ, String fieldName) there is a switch case and for the possible fields and there is only request which is set as NativeRequest and not as a string as mentioned in the proto (also, the object itself which is generated by protobuf has a string field for request and a NativeRequest objects from request_native. Therefore the string

...Native Spec request as an encoded string...

which is set in the request can't be set to the OpenRTB.BidRequest object.

Can you please help me what I am doing wrong? or maybe there is some bug? I can't get it working with a native request to my server.

Thank you.

Failed to generate Golang source file for openrtb.proto using proto3

OS- MacOS 10.14.4
protoc- v3.6.1
Golang Protobuf- v1.3.2
Google OpenRTB Protobuf- v1.5.5
Language- Golang

I am trying to generate protobuf Golang source file from openrtb.proto for protobuf3.

In the openrtb.proto file I added the syntax="proto3"; line and ran
protoc --go_out=. *.proto however the generation failed and I get the following error-

Explicit 'optional' labels are disallowed in the Proto3 syntax. To define 'optional' fields in Proto3, simply remove the 'optional' label, as fields are 'optional' by default.

I referred this issue #21 and I see that openrtb.proto supports protobuf3.

I want to use protobuf3, what am I doing wrong?

Exception for missing "id" even though "id" is present after the extension part

Hi,

I have the following extension:

import "openrtb.proto";

option java_outer_classname = "BidRequestExt";

message Extension {
    optional Udi udi = 1;
}

message Udi {
    optional string googleadid = 2;
    optional string idfa = 3;
}

extend com.google.openrtb.BidRequest {
    optional Extension ext = 1009;
}

When I use the following request:
{"adSizeRequest":"320x480","app":{"bundle":"com.dupovalo.chiromancer","cat":["IAB1"],"domain":"play.google.com","id":"130070556","name":"Chiromancer_fullscreen_Android_IAB_FULL_SCREEN_320x480_IAB1","publisher":{"id":"1001000269","name":"Derived Set Ltd"}},"at":2,"bcat":["IAB17-18","IAB7-42","IAB23","IAB7-28","IAB26","IAB25","IAB9-9","IAB24"],"device":{"connectiontype":0,"devicetype":1,"dnt":0,"dpidmd5":"67b6f2c97185890bc71b4e510df6539e","dpidsha1":"8c9797e124359124342650a49ddf8746e72c0479","geo":{"city":"Salvador","country":"BRA","lat":-12.864865,"lon":-38.479427,"metro":"0","region":"Bahia","type":3,"zip":"41338"},"ip":"200.223.92.185","js":1,"make":"Samsung","model":"GT-S7273T","os":"Android","osv":"4.2","ua":"Mozilla/5.0 (Linux; U; Android 4.2.2; pt-br; GT-S7273T Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30"},"ext":{"carriername":"unknown - probably WLAN","coppa":0,"operaminibrowser":0,"udi":{"androidid":"9f21ea9417a3e227","androididmd5":"67b6f2c97185890bc71b4e510df6539e","androididsha1":"8c9797e124359124342650a49ddf8746e72c0479","googleadid":"e74789d2-430e-4747-8740-96b27a5aa0f8","googlednt":0}},"id":"CiLnVi3dSE","imp":[{"banner":{"battr":[1,3,5,8,9],"h":480,"mimes":["application/javascript","image/gif","image/jpeg","image/png","text/html","text/javascript","text/plain"],"pos":0,"w":320},"displaymanager":"SOMA","ext":{"strictbannersize":1},"id":"1","instl":1,"tagid":"130070556"}],"user":{}}

I get an error
com.google.protobuf.UninitializedMessageException: Message missing required fields: id

However as you can see, I do have the id: "id":"CiLnVi3dSE",

If I change the order and I put the id ("id":"CiLnVi3dSE") before the entry for "ext" it works well:
{"id":"CiLnVi3dSE", "adSizeRequest":"320x480","app":{"bundle":"com.dupovalo.chiromancer","cat":["IAB1"],"domain":"play.google.com","id":"130070556","name":"Chiromancer_fullscreen_Android_IAB_FULL_SCREEN_320x480_IAB1","publisher":{"id":"1001000269","name":"Derived Set Ltd"}},"at":2,"bcat":["IAB17-18","IAB7-42","IAB23","IAB7-28","IAB26","IAB25","IAB9-9","IAB24"],"device":{"connectiontype":0,"devicetype":1,"dnt":0,"dpidmd5":"67b6f2c97185890bc71b4e510df6539e","dpidsha1":"8c9797e124359124342650a49ddf8746e72c0479","geo":{"city":"Salvador","country":"BRA","lat":-12.864865,"lon":-38.479427,"metro":"0","region":"Bahia","type":3,"zip":"41338"},"ip":"200.223.92.185","js":1,"make":"Samsung","model":"GT-S7273T","os":"Android","osv":"4.2","ua":"Mozilla/5.0 (Linux; U; Android 4.2.2; pt-br; GT-S7273T Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30"},"ext":{"carriername":"unknown - probably WLAN","coppa":0,"operaminibrowser":0,"udi":{"androidid":"9f21ea9417a3e227","androididmd5":"67b6f2c97185890bc71b4e510df6539e","androididsha1":"8c9797e124359124342650a49ddf8746e72c0479","googleadid":"e74789d2-430e-4747-8740-96b27a5aa0f8","googlednt":0}},"imp":[{"banner":{"battr":[1,3,5,8,9],"h":480,"mimes":["application/javascript","image/gif","image/jpeg","image/png","text/html","text/javascript","text/plain"],"pos":0,"w":320},"displaymanager":"SOMA","ext":{"strictbannersize":1},"id":"1","instl":1,"tagid":"130070556"}],"user":{}}

Can you please help me why there is a problem regarding the order of the entries in the JSON?

Thank you

Compat branch releases

Hi, are there any plans to release the compat branch for v1.1 of openrtb-core and doubleclick-openrtb?

Suppot of adm_native field in Bid Response

Hi,

It seems the library can't interpret properly some BidSwitch native bid responses.
BidSwitch is using the Native Object in their bid response however instead of putting it in the Bid.adm field they put it in the Bid.adm_native field.

{
  "id":"1234567890",
  "seatbid":[
    {
      "bid":[
        {
          "id":"1",
          "impid":"102",
          "price":9.43,
          "crid":"314",
          "cid":"42",
          "language":"en",
          "burl":"https://adserver.com/imp?impid=102&winprice=${AUCTION_PRICE}",
          "adomain":[
            "advertiserdomain.com"
          ],
          "ext":{
            "advertiser_name":"Coca-Cola",
            "agency_name":"CC-advertising",
            "agency_id":"abcd1234"
          },
          "adm_native":{
            "ver":"1.2",
            "jstracker":"<html></head><body></body><script src='./jquery.js'></script></html>",
            "privacy":"https://www.example.com/privacy-notice",
            "link":{
              "url":"http://adserver.com/click?impid=102"
            },
            "imptrackers":[
              "http://adserver.com/native?impid=102"
            ],
            "assets":[
              {
                "id":1,
                "required":1,
                "title":{
                  "text":"A test Native Ad"
                }
              }
            ]
          }
        }
      ],
      "seat":"58"
    }
  ]
}

Source: https://protocol.bidswitch.com/ssp-protocol/ssp-bid-response-examples.html#native-bid-response

I saw an issue fixed in the past dealing with this issue:
#85

However the Bid.adm_native does not seem to be properly interpreted when using JSON.

I had it working by adding the following code to
https://github.com/google/openrtb/blob/master/openrtb-core/src/main/java/com/google/openrtb/json/OpenRtbJsonReader.java#L1705 :

line 1717
case "adm_native":                                                                                                                                                                                                                                                  
         bid.setAdmNative(factory().newNativeReader().readNativeResponse(par));                                                                                                                                                                                            
         break; 

So I am wondering is this a bug or something intentional to avoid the usage of the adm_native field?
If this is a bug I can open a pull request with the changes and the testing.

Thanks!

OpenRTB integer fields defined as boolean in openrtb.proto

Hi all,

I'm trying to Unmarshal raw OpenRTB json BidRequests and BidResponses using golang's jsonpb using the openrtb.proto definition (https://github.com/google/openrtb/blob/master/openrtb-core/src/main/protobuf/openrtb.proto) as follows

br := new(openrtb.BidRequest)
jsonpbu := new(jsonpb.Unmarshaler)
jsonpbu.AllowUnknownFields = true
jsonpbu.Unmarshal(bytes.NewReader(<raw-json-byte-slice>), br)

yields
json: cannot unmarshal number into Go value of type bool

I've noticed the following fields are specified as type integer in the openRTB spec (https://www.iab.com/wp-content/uploads/2016/03/OpenRTB-API-Specification-Version-2-5-FINAL.pdf) and are defined as bool in your protobuf definition.

- BidRequest
    - test
    - source.fd
    - imp.instl
    - imp.clickbrowser
    - imp.secure
    - imp.banner.topframe
    - imp.banner.vcm
    - imp.video.skip
    - imp.video.boxingallowed
    - imp.audio.stitched
    - imp.pmp.private_auction
    - imp.native.aurlsupport
    - imp.native.durlsupport
    - imp.native.privacy
    - imp.native.assets[].required
    - site.privacypolicy
    - site.mobile
    - site.content.livestream
    - site.content.sourcerelationship
    - site.content.embeddable
    - app.privacypolicy
    - app.paid
    - app.content.livestream
    - app.content.sourcerelationship
    - app.content.embeddable
    - device.dnt
    - device.js
    - device.geofetch
    - device.lmt
    - regs.coppa
- BidResponse
    - seatbid.group
    - seatbid.bid.adm_native.assets[].required

Please note I'm unsure which OpenRTB version your proto is reflecting, but although a comment states 2.0 it contains fields which are in 2.5 but not in 2.0, so I linked 2.5.

Can you offer any insight as to why this is the case? Is there a way I can get around this without modifying the generated openrtb.pb.go code? I'd like to use your definition without having to fork and maintain it, if possible.

Thanks very much!

Docs for extension with protobuf to json

Hi,
Sorry for using the issues list to ask this question.
But I've been trying to use the library to connect to other exchanges by using the extensions, but it's a bit hard to get around. There seems to be a mismatch between the example provided in the tests and the actual library. For example

class ExchReader> extends OpenRtbJsonExtReader {
public ExchReader(GeneratedMessage.GeneratedExtension<?, ?> key) {
    super(key);
}

protected void read(EB msg, Bids.Exch.Builder ext, JsonParser par)
throws IOException {
switch (getCurrentName(par)) {
case "exch":
ext.setExch(par.nextTextValue());
break;
}
}

doesn't compile. Because the read methods need a Boolean as a return value.
Maybe I'm doing something wrong, but it would be nice to document a little how one can add extension to the library.
Thanks again for your work.

protoc warnings

Generating the code on Ubuntu 20.04 generates warnings. A small amount is here:

openrtb.proto:2166:3: warning: When enum name is stripped and label is PascalCased (Iab11), this value label conflicts with IAB1_1. This will make the proto fail to compile for some languages, such as C#.
openrtb.proto:2172:3: warning: When enum name is stripped and label is PascalCased (Iab12), this value label conflicts with IAB1_2. This will make the proto fail to compile for some languages, such as C#.
openrtb.proto:2176:3: warning: When enum name is stripped and label is PascalCased (Iab13), this value label conflicts with IAB1_3. This will make the proto fail to compile for some languages, such as C#.
openrtb.proto:2189:3: warning: When enum name is stripped and label is PascalCased (Iab14), this value label conflicts with IAB1_4. This will make the proto fail to compile for some languages, such as C#.

protoc version:

$ protoc --version
libprotoc 3.6.1

FWIW, we're generating C++ code, not C#.
Google's comments: protocolbuffers/protobuf#2179

Creating protbuf extensions for openrtb.proto in this library

Hi,
I am trying to use this library for open rtb integration. The problem I am facing is that for adding extension(ext field) corresponding to a particular exchange , I created a .proto file but the openrtb.proto file cannot be extended without copying it from the library.
Even if I copy the file(openrtb.proto) an OpenRtb.java file is generated by the protoc compiler.
How can I exclude a particular proto file from generating the java code?
If not how can I directly import the proto file from an external dependency, in this case your own library?

Also how can I add a list type to proto schema?(not like repeated field)

Exchange-specific AdUnitId causes NullPointerException

The OpenRTB Native Ads Specification 1.0 defines adunit as an integer value referencing section 7.2 Native Ad Unit IDs, which defines integer values 500 and above as "Reserved for Exchange specific formats". In the openrtb library this integer is implemented as a protobuf enum up to value 5 (there is a comment in the protobuf acknowledging the specification values of 500 and above). When exchange-specific integer values are parsed by the library, the parse fails with a NullPointerException. While this is correct according to the protobuf implementation, it is incorrect with respect to the OpenRTB specification. There are several other fields following the same pattern.

Since we have partners using these exchange-specific values, I was tempted to create a pull request with a fix, but I realized it's more of a design-level issue. One workaround could be to add an optional int32 to the protobuf for these fields named exchAdunit for example. Doing so, however, would require a modification to the JSON parse that would need to consider both the adunit and this new value in serialization/deserialization, most likely giving priority to the presence of the defined enums.

I'm interested in knowing what the preferred direction would be for a bug fix; I would say it's a bug due to the declaration in the specification.

How to import openrtb.proto in custom extension ?

@opinali
I've included following openrtb dependency.

<!-- https://mvnrepository.com/artifact/com.google.openrtb/openrtb-core -->
<dependency>
<groupId>com.google.openrtb</groupId>
<artifactId>openrtb-core</artifactId>
<version>1.2.1</version>
</dependency>

In wiki it says we can use protobuf extension to support OpenRTB Extension. In order to do so MyExtension.proto has to import openrtb.proto as follow, but this will not work because protoc is unable to find openrtb.proto, which is present somewhere in the jar.

syntax = "proto2";
package com.mz.extension;
option java_outer_classname = "MyExtension";

import "openrtb.proto"; //Unable to find it from the class path.

Feedback concerning upgrading to OpenRTB 2.3 JSON / Protobuf protocol

Hi Osvaldo,

I was integrating with the new OpenRTB protocols and I wanted to report some troubles I had so you can improve the wiki.
Just as a reminder, there is currently 3 major protocols:
1- Adx Protobuf
2- OpenRTB Protobuf
3- OpenRTB JSON

What I understood from this library is that it handles the OpenRTB part whereas openrtb-doubleclick helps integrate with Adx Protobuf in an OpenRTB fashion.

The major problem I had is the billing_id which needs to be provided in the answer as the cid. In the OpenRTB JSON format there's no problem but with the OpenRTB protobuf, one needs to expressly declare the extension. In terms of code, this doesn't work:

return OpenRtb.BidRequest.parseFrom(bytes).getImp(0).getExtension(AdxExt.imp).getBillingIdCount(); 
#0

But this does:

ExtensionRegistry reg = ExtensionRegistry.newInstance();
reg.add(AdxExt.imp);
return OpenRtb.BidRequest.parseFrom(bytes,reg).getImp(0).getExtension(AdxExt.imp).getBillingIdCount();
#1

That's not enough: if you want to convert your protobuf object to json, you also need to configure the OpenRtbJsonFactory with the extensions and that requires the following:

return AdxExtUtils.registerAdxExt(OpenRtbJsonFactory.create());

Once all that is done, everything seems to work fine.
There's one thing though that troubles me still but it may be normal: I was expecting to be able to part from the openrtb-doubleclick library once I've moved to the OpenRTB protocols. However, AdxExt and AdxExtUtils are part of it and are required to handle the billing_id so even though you're integrating OpenRTB protocols, you need the Adx lib. This may be because the OpenRTB protocols aren't yet final but I thought I'd bring it up.

I hope all this can help improve the wiki.
Thanks again for this library.

Native Bid Response could not be parsed

Hi,

until now I used version 0.8.1 without problems, with all higher versions I get an exception while reading the following native response:

{
  "id": "123456",
  "seatbid": [
    {
      "seat": "987654",
      "bid": [
        {
          "id": "1",
          "impid": "1",
          "price": 0.345,
          "nurl": "http://someurl.com/win/123456?price=${AUCTION_PRICE}",
          "adm": "{\"native\": {\"ver\":1, \"assets\": [{\"id\": 1,\"title\": {\"text\": \"title text\"}},{\"id\": 2,\"img\": {\"url\": \"http://mainimage.com\", \"w\":300, \"h\":400}},{\"id\": 3,\"img\": {\"url\": \"http://logoimage.com\", \"w\":100, \"h\":100}},{\"id\": 4,\"data\": {\"value\": \"caption text\"}},{\"id\": 5,\"data\": {\"value\": \"brand name\"}}], \"link\" : {\"url\":\"http://destination.com\", \"clicktrackers\":[\"http://clktracker.com/clk\"]}, \"imptrackers\" : [\"http://url.com/123\", \"http://url.com/345\"]}}"
        }
      ]
    }
  ]
}

Exception:

com.google.protobuf.UninitializedMessageException: Message missing required fields: link
    at com.google.protobuf.AbstractMessage$Builder.newUninitializedMessageException(AbstractMessage.java:372)
    at com.google.openrtb.OpenRtbNative$NativeResponse$Builder.build(OpenRtbNative.java:14273)
    at com.google.openrtb.json.OpenRtbNativeJsonReader.readNativeResponse(OpenRtbNativeJsonReader.java:310)
    at com.google.openrtb.json.OpenRtbNativeJsonReader.readNativeResponse(OpenRtbNativeJsonReader.java:303)

The adm value seems to be the problem, expected is {"ver":1, "assets":[...]} and not {"native": {"ver":1, "assets":[...]}}.

If a response is created with the OpenRtb.BidResponse.Builder the native attribute is also not created.

Is that the desired behaviour?

If I understand the OpenRTB Native Ads Specification correctly, there should be a native attribute in the adm JSON. The example Bid Response JSON in the specification also includes the native. Or do I get it wrong?

Incorrect "battr" value produces null pointer on JSON deseriailzation

Hello,

If I try to deserialize OpenRtb.BidRequest from json

OpenRtb.BidRequest bidRequest = OpenRtbJsonFactory.create().newReader().readBidRequest(json);

with banner request that has incorrect (by OpenRTB specification) battr, for example

"battr": [2, 17]  //1-16 by specification

I get

java.lang.NullPointerException
    at com.google.openrtb.OpenRtb$BidRequest$Imp$Banner$Builder.addBattr(OpenRtb.java:11190)
    at com.google.openrtb.json.OpenRtbJsonReader.readBannerField(OpenRtbJsonReader.java:566)

Two problems:

  1. NullPointerException - should be more detailed diagnostic info I think
  2. You think and write in Wiki about extensions. We should think about them here too. For example, save non-standard attributes codes to another int array. Maybe it should be configurable with extension.
    Example of Rubicon BidRequest where they use non-standard creative attributes.

valid adm content and dynamic banners.

Dear,

I apologize if this is not the right place for this issue.

The goal of our advertisement system is to serve dynamic creatives, where each creative can contain multiple products and with up to date prices the products.

But I've looked into the documentation of adX and the openRTB specification. But none of the documentations give a good example of what is allowed as adm content.
The examples i found was "html snippet", "<script>...</script>", "<img src="rainbow.gif">"

But could i use an iframe in the adm field? like "<iframe src=https://google.com><iframe>" and the domain of the correct advertiser.

I still have an adx specific question, the creative id is marked as optional by the rtb standard, However the adx states that the response should contain a creative id and that each unique creative needs its own creative id.

Now i'm wondering if i have to validate every creative first before i can use the creative id. Or if i can just generate one by for example hashing the src url of the iframe without validating it?
Since the buyers api only allows for a validation of 1000 creatives a day. But with creative banners we could have all possible combination of the products an advertiser is selling.

Kind regards, Boris Smidt

Version Specific BidRequest Writers

@opinali
This library does not provide version specific writer. I mean if I want to send RTB 2.3 BidRequest to DSP1 and RTB 2.4 BidRequest to DSP2, the what is the best way to do it ?

How to create BidResponse and send it in JSON format

Hello,

I try to encode a BidResponse in JSON format but without success.
I know that in the last version of this package, you removed the OpenRtbJsonFactory.
How to convert a BidResponse in JSON with the last version of this package ?

Regards

Error in Android 6.0.1

When i use this library in android app, I get below message, I have used Java 8.

W/System.err: java.lang.NoClassDefFoundError: com.google.openrtb.json.OpenRtbJsonFactory$$Lambda$0
W/System.err: at com.google.openrtb.json.OpenRtbJsonFactory.(OpenRtbJsonFactory.java:81)
W/System.err: at com.google.openrtb.json.OpenRtbJsonFactory.newWriter(OpenRtbJsonFactory.java:201)

OpenRTB Native Request - Issue with "native" field

This is related to the discussion at : https://groups.google.com/forum/#!topic/openrtb-native/ecrjonP-rIs

There are 2 flavors of the "native" field under "imp" in Bid request.
A) "native": {"request": "{"native": {"adunit": 3, "layout": 3, "assets": [...] }}"}
B) "native": {"request": "{"adunit": 3, "layout": 3, "assets": [...]}"}

[Actual] When I run the UTs under OpenRtbJsonTest, I see that json is getting serialized to option#(A) above.
[Expected] However, the documentation for this project seems to suggest that it should be serialized to option# (B).

Any insights into this discrepancy? Here is a link to the doc: https://github.com/google/openrtb/wiki#native-ads
(Note: I am using openrtb-core-0.9.3.
I haven't tried running UT on the latest version of openrtb-core because of Java 8 dependencies).

A a side note, Please let me know if there is a way for me to generate requests as shown in option# (B) above using this library.

Bid categories mapping

Hi,

I found a unexpected behaviour when creating an OpenRtb.BidResponse object from a JSON. Categories specified in the Bid object are not mapped correctly.

Here is what I am using:

 OpenRtb.BidResponse googleOpenRtbResponse = jsonFactory.newReader().readBidResponse(json);

Here is an example of JSON:

{
  "id": "CXc2BjQQXCRKFtNe1Rj1HQ",
  "seatbid": [
    {
      "bid": [
        {
          "id": "a197de04-0d97-4d9b-8661-96ec9590bbd9",
          "impid": "54",
          "price": 5.45,
          "adid": "...",
          "adm": "...",
          "adomain": [
            "domain.com"
          ],
          "iurl": "http://someurl.com/fafa43v53.png",
          "cid": "57085882",
          "crid": "9f0c998dfa5a042f643285a60c6eb21a",
          "h": 50,
          "w": 320,
          "ext": {
            "attr": [
              47
            ],
            "click_through_url": [
              "http://www.domain.com"
            ]
          },
          "cat": [
            "IAB9-30",
            "IAB14-1",
            "IAB23",
            "IAB23-1",
            "IAB23-2",
            "IAB23-3",
            "IAB23-4",
            "IAB23-5",
            "IAB23-6",
            "IAB23-7",
            "IAB23-8",
            "IAB23-9",
            "IAB23-10"
          ]
        }
      ],
      "seat": "38528903462562"
    }
  ]
}

So, the categories are:

[IAB9-30, IAB14-1, IAB23, IAB23-1, IAB23-2, IAB23-3, IAB23-4, IAB23-5, IAB23-6, IAB23-7, IAB23-8, IAB23-9, IAB23-10]

And the result I am obtaining from "googleOpenRtbResponse.getSeatbid(0).getBid(0).getCat()" is:

IAB1

The first question is, shouldn't be "cat" within "OpenRtb.BidResponse.SeatBid.Bid" a collection of categories?

The second question is, why is it mapping to IAB1?

Thanks

Preliminary support for protobuf 3.0

Major new release finally out, or close: 3.0.0-alpha-2 available now, together with the first public gRPC also in alpha status. The openrtb-core and doubleclick-core/doubleclick-openrtb libraries may support proto3, after proto3 is released as GA.

Some expected advantages:

  • Official support for a wider range of languages and platforms (useful at least to compile the RTB model, since utilities like validator, etc. are Java-specific).
  • New Any type will make OpenRTB extensions less verbose / easier to use.
  • Built-in support for JSON, if good enough (esp. adequate support for extensions), may allow us to remove lots of code, and also make at least the openrtb-core library way more useful to arbitrary languages since the RTB model + JSON serialization are 90% of users' needs.
  • The JavaNano option may be useful for Android, especially if the rest of the library is also ported to Android. Idea to consider if there's significant user demand.

Expected disadvantages:

  • Breaking change: Any is nicer, but not backwards compatible with the proto2 extension system. But that's a good tradeoff, and impacts only the ext fields.
  • Breaking change: No hasXxx() methods anymore. Easy to fix, but potentially lots of small changes for people owning significant code.

Current plan:

  1. Version 0.8.0 of the libraries will be tested with the proto3 compiler and runtime library. They provide full backwards compatibility for proto2, so everything should just work, without any changes or impact.
  2. After the proto3 GA, the next release of the openrtb libraries will depend on proto3 for compilation and runtime. But they will keep proto2 syntax, so no impact at all yet.
  3. Final step will be moving the libraries to proto3 syntax.

Missing Field Values for native bid request

Hi There,

OpenRtb-core does not support plcmttype above 4 in bid request.
This is basically an enum:
enum PlacementType {
// In the feed of content - for example as an item inside the organic
// feed/grid/listing/carousel.
IN_FEED = 1;
// In the atomic unit of the content - IE in the article page
// or single image page.
ATOMIC_UNIT = 2;
// Outside the core content - for example in the ads section on the
// right rail, as a banner-style placement near the content, etc.
OUTSIDE = 3;
// Recommendation widget, most commonly presented below
// the article content.
RECOMMENDATION = 4;
}

Is there any workaround to this? OpenRtb spec says this field is a custom field set by SSP's.
I think this should be available to be read as a custom int instead of using pre-defined enums.

Please advise.

Infinite loop when parsing BidRequest json with unknown extensions

Omitting unknown extensions seems to be promising feature , but it looks like there is some bug there. (0.8.2 used). When I try to parse following BidRequest JSON with some extensions reader gets into infinite loop.
Could you please try and advice what's wrong:

{
  "app": {
    "cat": ["IAB20"],
    "domain": "microsoft.com",
    "id": "65848430",
    "name": "Windows_ROW_300x50",
    "publisher": {"id": "923881016"}
  },
  "at": 2,
  "device": {
    "connectiontype": 0,
    "devicetype": 1,
    "dnt": 0,
    "geo": {
      "country": "IND",
      "lat": 18.975,
      "lon": 72.8258,
      "type": 1
    },
    "ip": "114.79.158.227",
    "js": 0,
    "make": "Generic",
    "model": "Windows Phone 8",
    "os": "Windows Phone OS",
    "osv": "8",
    "ua": "Windows Phone Ad Client/6.2.960.0 (Silverlight; MS_ORMMA_1_0; Windows Phone OS 8.10.14226.0; Microsoft; RM-1090_1001)"
  },
  "ext": {
    "carriername": "unknown - probably WLAN",
    "coppa": 0,
    "operaminibrowser": 0,
    "udi": {"wpid": "1083402449863976572"}
  },
  "id": "Ax1jZdSvJk",
  "imp": [
    {
      "banner": {
        "battr": [
          1,
          3,
          5,
          8,
          9
        ],
        "btype": [
          1,
          3
        ],
        "h": 50,
        "mimes": [
          "image/gif",
          "image/jpeg",
          "image/png"
        ],
        "w": 300
      },
      "displaymanager": "SOMA",
      "id": "1",
      "instl": 0
    }
  ],
  "user": {}
}

Null values in JSON BidRequest

The following example supplied from an exchange i am currently integrating causes a NullPointerException.

java.lang.NullPointerException
at com.google.openrtb.OpenRtb$BidRequest$Content$Builder.setKeywords(OpenRtb.java:30481)
at com.google.openrtb.json.OpenRtbJsonReader.readContent(OpenRtbJsonReader.java:601)
at com.google.openrtb.json.OpenRtbJsonReader.readApp(OpenRtbJsonReader.java:554)
...

{
  "id": "a378585e9f1f4a898bc0f99bbdc55043",
  "app": {
    "content": {
      "keywords": null
    },
    "id": "56600",
    "cat": [
      "IAB19",
      "IAB19"
    ],
    "keywords": "",
    "name": "Emoji Free!",
    "ver": null
  },
  "tmax": 100,
  "imp": [
    {
      "id": "ebf3810e-c863-4e80-9b36-87905e8dd179",
      "instl": 0,
      "banner": {
        "w": 320,
        "api": null,
        "h": 50
      }
    }
  ],
  "device": {
    "os": "iOS",
    "model": null,
    "didsha1": null,
    "connectiontype": 0,
    "geo": {
      "country": "GBR"
    },
    "dpidsha1": "18f9e414250b14608fd817fba3aafd158384740a",
    "osv": null,
    "ua": "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+(KHTML, like Gecko) Version/3.0 Mobile 1A543 BMID/E678F7A18C",
    "devicetype": 1,
    "language": null,
    "make": "Apple",
    "ip": "46.233.116.169"
  },
  "at": 2,
  "user": {}
}

the issue originates from protobuf handling of null, this is a point of controversy (wont fix) over at: https://code.google.com/p/protobuf/issues/detail?id=57

whats the best approach for dealing with this?

  1. patch protoc: https://code.google.com/p/protobuf/issues/attachmentText?id=57&aid=-4911620611025401999&name=null_check.diff.

  2. implement checks for null in OpenRtbJsonReader in some way (extend JsonParser?).

  3. catch the exception inside the loop of all OpenRtbJsonReader methods and carry on

  4. or something else?

JSON parser enters infinite loop

The following JSON causes the bid request parser to enter infinite loop.

{
    "id": "8652a8680db33faabbf3fa76150f35df50a67060",
    "imp": [
        {
            "id": "121-dt1",
            "banner": {
                "h": 250,
                "w": 300,
                "pos": 1
            },
            "bidfloor": 0.05
        },
        {
            "id": "121-dt2",
            "banner": {
                "h": 728,
                "w": 90,
                "pos": 0
            },
            "bidfloor": 0.12
        }
    ],
    "site": {
        "id": "15047",
        "domain": "dailymotion.com",
        "cat": "IAB1",
        "page": "http://www.dailymotion.com/video/xxeauj_www-dramacafe-tv-hd-yyyy-yy-yyyyyyy-2012-yyyy_shortfilms",
        "publisher": {
            "id": "8796",
            "name": "dailymotion",
            "cat": "IAB3-1",
            "domain": "dailymotion.com"
        }
    },
    "user": {
        "id": "518c3da3717203f34019b038"
    },
    "device": {
        "ua": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; (R1 1.6); SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)",
        "ip": "123.145.167.189"
    },
    "at": 1,
    "cur": [
        "USD"
    ]
}

It does not fully conform to OpenRTB 2.2/2.3 specification: site/cat and site/publisher/cat attributes must be arrays of strings, not strings. It was taken from here:
https://github.com/openrtb/examples/blob/master/brandscreen/example-request-pc-multi.json

Unable to use extensions 'ext'

Hi,
I'm working on a project and have extended BidRequest

import "openrtb.proto";
package com.company.project;
option java_outer_classname = "OpenRtbExt";

extend com.google.openrtb.BidRequest {
  optional string ext = 300;
}

I'm using springboot that has support for converting JSON to protobuf messages(ProtobufHttpMessageConverter). It works fine without using "ext" json key. If I uncomment "ext" in below json, I get below exception:
com.google.protobuf.InvalidProtocolBufferException: Cannot find field: ext in message com.google.openrtb.BidRequest

{
  "id": "000000000000000",
//   "ext": "Something",
  "imp": [
    {
      "id": "1",
      "native": {
        "request_native": {
          "ver": "1.2",
          "context": 2,
          "contextsubtype": 20,
          "plcmttype": 4,
          "plcmtcnt": 1,
          "aurlsupport": false,
          "privacy": true,
          "eventtrackers": [
            {
              "event": 1,
              "methods": [
                1,
                2
              ]
            },
            {
              "event": 2,
              "methods": [
                1
              ]
            }
          ],
          "assets": [
            {
              "id": 123,
              "required": true,
              "title": {
                "len": 140
              }
            },
            {
              "id": 128,
              "required": false,
              "img": {
                "wmin": 836,
                "hmin": 627,
                "type": 3
              }
            },
            {
              "id": 124,
              "required": true,
              "img": {
                "wmin": 50,
                "hmin": 50,
                "type": 1
              }
            },
            {
              "id": 4,
              "video": {
                "linearity": 1,
                "minduration": 15,
                "maxduration": 30,
                "protocols": [
                  2,
                  3
                ],
                "mimes": [
                  "video/mp4"
                ]
              }
            }
          ]
        }
      }
    }
  ]
}

Other related questions:

  • When is the plan to support proto3?
  • Why int fields from Native Ads spec 1.2 is using bool? Example 'required' is an optional int that is allowed 0 or 1. openrtb.proto defines this as bool so json expects it to be 'false'

Exception on empty input stream or string

Now code like

OpenRtbJsonFactory.create().newReader().readBidRequest("");

leads to

com.fasterxml.jackson.core.JsonParseException: Expected start of object
 at [Source: com.google.common.io.CharSequenceReader@1cab0bfb; line: 1, column: 1]
    at com.google.openrtb.json.OpenRtbJsonUtils.startObject(OpenRtbJsonUtils.java:47)
    at com.google.openrtb.json.OpenRtbJsonReader.readBidRequest(OpenRtbJsonReader.java:132)
    at com.google.openrtb.json.OpenRtbJsonReader.readBidRequest(OpenRtbJsonReader.java:112)
    at com.google.openrtb.json.OpenRtbJsonReader.readBidRequest(OpenRtbJsonReader.java:105)

which is not a bug, but it's not easy to use, if I want to have null in this case I should firstly check stream in my code. Would be great to have some built-in ability like (similar to Jackson features)

OpenRtbJsonReader#enableFeature(OpenRtbParseFeatures.EMPTY_INPUT_AS_NULL)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.