Code Monkey home page Code Monkey logo

Comments (4)

opinali avatar opinali commented on July 28, 2024

This one will take some time — the JSON extension API is already the part of this library I'm less happy about. Good that for now you have a workaround, meanwhile I'm lookingo into a real improvement for this API instead of just adding another special case.

from openrtb.

opinali avatar opinali commented on July 28, 2024

Ok, the latest code on master should fix this last limitation, also it does the big revamp of the JSON extension API that I'd been putting off for too long. This required breaking changes but not too bad and the new code is simpler–most readers will lose one generic parameter so you don't need to use a dummy ..., Message.Builder>; others will have to change the base class and lose the first parameter in the read() method. Some work too for easier development like proper abstract methods and more error handling and logging.

I'm afraid testing this can be difficult before the next Open Bidder is released because the code in master for these libraries include other changes (even a rare breaking change in the AdX protocol), but there are new unit tests that reproduce your use case so hopefully this will solve the problem.

from openrtb.

thaDude avatar thaDude commented on July 28, 2024

Thank you for looking into this. I'll test this in the context of the next OB release!

from openrtb.

thaDude avatar thaDude commented on July 28, 2024

Hi, just for completeness' sake - my original work-around did not have the intended effect. I just settled for something like this:

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

    private String keyName;

    public EventExtensionReader(GeneratedExtension<?, ?> key) {
        super(key);
        this.keyName = key.getDescriptor().getName();
    }

    @Override
    protected void read(Bid.Builder msg, Event.Builder ext, JsonParser par) throws IOException {
        String fieldName = getCurrentName(par);
        if (keyName.equals(fieldName) == false) {
            return;
        }
        Type type = Type.valueOf(getCurrentName(par).toUpperCase());
        EventUtils.read(ext, type, par);
    }

}

The only drawback of this solution is that it requires a different reader instance for each key type - click, impression in my case. The read method returns early if the field name does not match the key. I can live with that.

from openrtb.

Related Issues (20)

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.