Docs for extension with protobuf to json
samklr opened this issue · 5 comments
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.
This documentation is not in sync anymore with the code if you get the latest code from master; but it should be right for the last release (0.8.0-beta4). The JSON extension API is changing indeed, when the next release is out (which will be soon and hopefully the final 0.8.0) the docs will be updated to match it; but let's keep this bug open as a reminder :)
P.S.: You are right that this part of the API is difficult; one of the motivations for the changes I'm making now is to make it simpler and more type-safe.
Yes after reverting to an old version,I figured that out indeed. I'll try with the master ...
Thanks.
Hi Osvaldo.
I have been trying to use the code on master, since it's the only one with clear tests for handling protobuf extensions, but I can't seem to find the 0.8.1-SNAPSHOTS on maven central. Are they published somewhere?
Also it would be nice for further improvement,,if you could provide an example like in the Tests,based for example on your wiki, with the "SpaceAds" example.
Thanks.
Hi Sam,
The latest changes have been finally released with the final 0.8.0, please
use that instead of master, as of today there are no additional changes in
master and hopefully this will keep true for some time (and the next 0.8.x
versions will be backwards-compatible, focused on fixes or minor stuff,
etc.). Can't release snapshot jars to maven-central even if I wanted :) so
if you need snapshots you always have to pull the sources and 'mvn install'.
Sample code are still a weak part of the project; it does't include proper
samples, OTOH it does have very high unit test coverage and you should find
test code that can sort of double as sample code for everything. For
extensions, look here
https://github.com/google/openrtb/tree/master/openrtb-core/src/test/protobuf
and here
https://github.com/google/openrtb/tree/master/openrtb-core/src/test/java/com/google/openrtb/json.
But it's another good point that the wiki uses an example that doesn't
match any code in the project, ideally the docs should use code from some
sample or even test code, adding that to my todo list.
On Sun, Apr 26, 2015 at 8:25 PM, Sam Bessalah notifications@github.com
wrote:
Hi Osvaldo.
I have been trying to use the code on master, since it's the only one with
clear tests for handling protobuf extensions, but I can't seem to find the
0.8.1-SNAPSHOTS on maven central. Are they published somewhere?
Also it would be nice for further improvement,,if you could provide an
example like in the Tests,based for example on your wiki, with the
"SpaceAds" example.Thanks.
—
Reply to this email directly or view it on GitHub
#28 (comment).
Osvaldo Doederlein | Software Engineer, Doubleclick Ad Exchange |
opinali@google.com
Thanks Osvaldo.
I'll do just that. I'll keep you updated.