Closed pratikkumar19 closed 8 years ago
Hi,
I am facing the exact same problem, did you find any solution? I would appreciate your help.
Regards.
The OpenRTB-extension mechanism used by the library is designed to be modular, not requiring any changes to the core proto; you define the extensions in a different proto (which imports openrtb.proto
). I realize the documentation provided in the wiki is very summarized, it's already planned to be improved, will try to work on that soon. But you can check the examples hidden inside the unit tests, look at the test-*.proto
files and the code that uses them (not the most didactic material because it's written as test and not as sample code, but I guess better than nothing for now). A better source of sample code would be the companion DoubleClick OpenRTB library, see this proto and if you need JSON support for extensions see also this package, it's a decent real-world example.
@pratikkumar19
Thanks, I will try it and will update, hopefully I will get it working.
Please approve if it is correct:
extend BidRequest {
optional int32 bar = 110;
}
Thank you
Yes that's a correct start; to compile you will need the core openrtb.proto and you need an import "openrtb.proto";
in your file. You could just make a copy of the openrtb.proto to your project, but if you want to automatically keep it in sync with the library as you move to newer versions, you can use Maven's download-maven-plugin
(or something equivalent in other build systems). Basically your build file needs to download openrtb.proto from this github repo, put it in a local directory and add that to the import path for protoc
. You can copy the necessary configurations from this build file; the pieces you need are the following:
build-helper-maven-plugin
configurationdownload-maven-plugin
configurationmaven-antrun-plugin / generate-protoc
config, check the <arg value="-I${protobufGenerated}/include" />
Thanks @opinali
Thanks @opinali I managed following your assistance
I was able to solve this as follows: in my new *.proto file I added the import as so: import "openrtb.proto";
I then added the dependency as usual in maven.
I used the protobuf-maven-plugin plugin which makes me put the .proto files in the "src.main.proto" directory, but the import works and code is being generated as reuested.
im using scala and the generated proto has "openrtb.openrtb" as package name for the ext how to fix?
found it flatPackage => true in sbt package
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)