Code Monkey home page Code Monkey logo

Comments (2)

aravindbargurhiriyannaiah avatar aravindbargurhiriyannaiah commented on July 28, 2024

Hello @sevebisogni
Can you please explain why this was closed? And how to get around the above discrepancies between the Proto files and IAB specification?

from openrtb.

opinali avatar opinali commented on July 28, 2024

Hi, sorry for not noticing this way back before the issue was closed. The mapping of bool fields has been detailed elsewhere, but probably only in the openrtb discussion groups and other documents many years ago. But the TLDR is that this proto is biased for strong typing, this includes not only bools but also enums instead of ints everywhere like in the spec.

Some Protobuf libraries, including Google's public Protobuf project, have JSON serialization functionality that have an option to serialize bools to 1/0 and deserializing those back to bools. I am no specifically familiar with jsonpb but maybe there's an option like that too, by the way many JSON libraries in general support this option, for example in Jackson (the most popular JSON API for Java) you can do that with @JsonFormat(shape = Shape.NUMBER). This is a very common issue in JSON because 1/0 take a lot less space than true/false, but using ints for fields that are semantically booleans is a very poor choice for any static-typed language.

The proto is perfectly compatible with the spec if you have a Proto/JSON library that can use the correct on-wire representation of 0/1. The spec only describes the on-wire messages, it doesn't describe an API.

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.