Comments (4)
You have a good point/find that deserializing this JSON should never fail with a NullPointerException
. I guess the best option is not failing at all, just ignoring the unsupported values. Will be fixed in next release.
Now on the second problem of providing some kind of support for non-standard values: this is one explicit tradeoff made by the library, we wanted both the safety and convenience of fields typed as enumerations, instead of having tons of int32
fields everywhere. The flipside is that supporting extended enum values is not possible, at least not in any elegant way (yes I could play with protobuf's support for "unknown values"... it would require reserving separate tag IDs and hacks in several places). But the most important factor is that this tradeoff is actually minimal, because this kind of extension is not generally allowed; the only enum explicitly documented to allow exchange-specific values is the at
(Auction Type) IIRC; and even there you have to use ordinal numbers above 500, you can't just pick the first "free" number. This is highly likely to clash with new standard creative attributes that may be added in future versions of the spec (unless the spec just adopts as standard this new attribute from Rubicon; but that doesn't scale to multiple vendors doing the same hack). In the native spec this is similar, vendor-specific enums all above 500, except that this is explicitly allowed for all enums from that spec.
I suggest that you fork the library and just add a new enum element for attribute 17, if not losing it is critical.
from openrtb.
Hi,
17 is just a value to localize error for you, that we have an error on values above maximum provided by specification. I have no need to handle this specific value. Rubicon used values above 10000 in attached example. Maybe it's an outdated sample.
Your solution is absolutely fine with me if using values not from specification is prohibited be spec for this attribute. In that case - look at it issue as a report about NullPointer.
One general note - it would be great to have two options dealing with elements not from schema/specification - "ignore" and "fail whole process with exception".
Thank you,
Dmitry
from openrtb.
Happy to know Rubicon doesn't break the spec in this way, that seemed surprising considering their role creating the standard :) The NPE was an easy fix... can't wait for Protobuf 3 GA so we can stop writing handcoded JSON parsers for this :(
Optional failure is a good idea too.
from openrtb.
Just got in the code to fix this, you can test with master but we should have a release soon.
from openrtb.
Related Issues (20)
- Native Data Asset Type >= 500 throws error during deserialization. HOT 1
- When enum name is stripped and label is PascalCased (Iab11), this value label conflicts with IAB1_1 HOT 7
- Extension Json Serialization Documentation Lacking HOT 2
- Version Specific BidRequest Writers HOT 4
- build DSP
- Wrong default value for deal auction type. HOT 3
- Handling 500+ DataAssetType Values HOT 7
- Fix miniumum JDK version in README.md HOT 1
- valid adm content and dynamic banners.
- Cannot find VideoBidResponseProtocol when running example HOT 1
- Error in Android 6.0.1
- Suppot of adm_native field in Bid Response HOT 2
- Missing Field Values for native bid request
- Failed to generate Golang source file for openrtb.proto using proto3 HOT 1
- Cannot import specific class in Eclipse HOT 4
- OpenRTB integer fields defined as boolean in openrtb.proto HOT 2
- How to add a missing field from the OpenRTB spec? HOT 1
- protoc warnings HOT 1
- Unable to use extensions 'ext'
- How to create BidResponse and send it in JSON format HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openrtb.