-
Notifications
You must be signed in to change notification settings - Fork 190
Handling 500+ DataAssetType Values #120
Comments
This seems like a larger problem than just the data asset types. One possible solution is to add entries 500 to 999 in the protobuf enum values and mark them as exchange-specific. For example:
Another option would be to add a configuration variable to ignore exchange-specific values & to drop the asset altogether. This does not seem like an optimal solution, but it may be acceptable for the majority of exchanges. |
Right, the tradeoff of the strongly-typed enums is that they cannot accept extended values without further modification. There are a few alternatives:
The problem with option 2 is the JSON support library, it throws the exception above because the JSON reader does not support extended values. I think this can be improved, let me know if this support would be useful i.e. if you think the unknown-field proto feature is a good way of handling this, provided that JSOn mapping would work. |
In some cases, I do not believe option 2 is a possibility, as the enum value is required. I believe the best way to handle this is to add support for the exchange-specific enum values in the protobuf, and to put it on the users of the library to determine the meaning of the value based on the exchange/partnership. This gives everyone the flexibility to handle these values gracefully without the need to fork the library. |
I confirmed that PR #121 fixes my issue. Is it possible to include this in the next release? |
Sorry for taking some time to review this. And thanks for the patch, I understand how this is useful for scenarios like yours. But we cannot accept the patch, this is unfortunately not compatible with the design of this proto which admittedly contains a significant tradeoff in the area of strong typing vs. extended values, but it's a point that we consider important. To put in a different way: if you need these nondescript enum names like
The extended values also have some problems: it's a metric ton of new code (even if it's all autogenerated boilerplate), and they only cover a relatively short range of 500 values per enum (what happens if some other exchange that you did not consider is using even bigger values, add thousands of extra identifiers to all enums? the spec does not limit extended values to 999). However, it's a reasonable workaround to have as a fork, but we only don't want to commit to that as a supported solution and stable API for this problem so it just can't live in the main repo and the published maven libs. As I mentioned here, we're planning to find a better workaround, maybe improving the JSON serializer, possibly reevaluating the decision of using typed enum fields instead of ints (this is the kind of review that needs to wait for a major release -- which is planned later this year: moving to proto3 syntax, which involves other major changes). |
This is still an issue and is pretty annoying. It means we cannot parse some native bid requests from some exchanges. I am attaching a bid request (with any PII removed) that came from an exchange and causes an error to be thrown. I think this field should be changed to an int32 type, but a least some of the exchange specific enums suggested in the patch would help us work around this problem. |
I'm interested in this problem for how we address it in OpenRTB 3.0. It seems to me we should 1. keep the |
We are receiving messages from a 3rd party which contain DataAssetTypes of 501, 502, etc. The 500+ range is defined in the openrtb spec for "exchange specific usage".
readBidRequests() fails to process messages containing these data types (stacktrace below).
I believe enum's cannot be extended in protobuf. What would be the best way to allow processing of these messages?
The text was updated successfully, but these errors were encountered: