Git Product home page Git Product logo

Comments (4)

drjbutler avatar drjbutler commented on July 30, 2024

from openrtb.

mxmCherry avatar mxmCherry commented on July 30, 2024

Oh, I definitely missed the CUSTOM_... bit, thanks for explanation.


Though looks that my question is about something other - the Macro JSON format itself. And I'd better prefer to double-confirm it to be 100% sure I'm getting it right (docs are somewhat confusing).

So looks like this is the way to marshal the Macro object:

{
  "TIMESTAMP": "2018-10-14"
}

Which:

  • is provided in BidResponse example JSON;
  • so meant to be marshaled in this particular way by 3.0 spec;
  • and it would result in ${CUSTOM_TIMESTAMP} to be replaced with 2018-10-14 in prepared ad snippet/URLs.

Right?


I have some concerns about this (the format itself and then how it's explained in spec).

  1. IMO, this format is inconvenient for typed languages - you usually have to declare classes/structs with predefined set of object keys for proper marshal/unmarshal. Having dynamic keys usually requires more lines or more tricky code for proper processing (unless you switch to less performant/GC-heavy map/dictionary types).

Roughly:

{
  "key": "TIMESTAMP",
  "value": "2018-10-14",
  "ext": {
    "custom": "data"
  }
}

Is way more easier to parse (or, better said, not to "parse", but to "model" - make class for it) than:

{
  "TIMESTAMP": "2018-10-14",
  "ext": {
    "custom": "data"
  }
}

Yep, I get that "convenient" way is much less compact than having dynamic keys (as suggested in spec), but still - clearer and easier to use (especially with "key" and "value" shortened to just "k" and "v").

Also, for example, in Bid object doc Macro is used as object array.

Which, to be honest, would look weird (at least to me):

[
  { "TIMESTAMP": "2018-10-14" },
  { "FOO": "BAR" },
  { "BAZ": "QUX" }
]

Like, why pack these into array, if we could just have:

{
  "TIMESTAMP": "2018-10-14",
  "FOO": "BAR",
  "BAZ": "QUX"
}

(which would be even more compact)

That's another reason of why I was confused with Macro doc (the object array thingy).

Anyway, I don't think that's going to change (at least not after 3.0 hit the BETA status), so consider this just a way-too-late developer's rant 🙂

  1. This dynamic-key format is not very obvious from the doc:
Attribute Type Definition
key string; required Name of a buyer specific macro.
value string Value to substitute for each instance of the macro found in markup.
ext object Optional demand source specific extensions.

As a developer, "used" to other OpenRTB 3.0 object docs, I'm expecting Macro JSON to look like this:

{
  "key": "TIMESTAMP",
  "value": "2018-10-14",
  "ext": {
    "custom": "data"
  }
}

And not like this:

{
  "TIMESTAMP": "2018-10-14",
  "ext": {
    "custom": "data"
  }
}

I'd "vote" to add some explanation / note / WARNING that it's the second JSON example and not the first. Like, right in Macro object section, and not just in Examples (which itself is a bit sloppy - I mean #9). Though I can't think of a better way than including macro JSON example right into Macro object section (which would contradict other object docs though).

from openrtb.

drjbutler avatar drjbutler commented on July 30, 2024

from openrtb.

mxmCherry avatar mxmCherry commented on July 30, 2024

Oh, that's awesome then!

In this case Macro object doc is totally fine (CUSTOM_... explanation bits are up to you).

Example JSON - will PR the fix in ~ 8-9h. Unless it's fixed in master before 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.