Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native bid missing some required properties error on NON REQUIRED fields #6587

Closed
guiann opened this issue Apr 14, 2021 · 4 comments · Fixed by #6678
Closed

Native bid missing some required properties error on NON REQUIRED fields #6587

guiann opened this issue Apr 14, 2021 · 4 comments · Fixed by #6678
Assignees

Comments

@guiann
Copy link
Contributor

guiann commented Apr 14, 2021

Type of issue

Limitation which looks buggy according to prebid documentation

Description

when reponding with an "icon" or "image" field as string in a Native bid response the bid is always invalid.
Even if the icon/image is NOT required.

Steps to reproduce

From any native test page. set icon: required false in native request.
in your adapter force an icon value like:

bid.native.icon = 'https://fo-static.omnitagjs.com/fo-static/native/images/info-ayl.png';

According to the doc, this shouldn't be checked as it's not even required.
And if it's required and the value is checked, a string or an object should be valid:

All assets can be returned as strings, or images can be returned as objects with attributes url, height, and width.

Actual results

The code inside nativeBidIsValid from src/native.js disallow image or icon without width or height field. So strings are not allowed.
No matter if the field was required or not.

Expected results

values like:
bid.icon = 'https://fo-static.omnitagjs.com/fo-static/native/images/info-ayl.png
bid.image = 'https://fo-static.omnitagjs.com/fo-static/native/images/info-ayl.png

should be valid since partners dont always provide icons width and height.
Or at least we can remove the check if values are not required ?

Other information

Here is the code from "nativeBidIsValid".
Note that this is done before "required" status concern.

Prebid.js/src/native.js

Lines 80 to 90 in 41e050a

if (deepAccess(bid, 'native.image')) {
if (!deepAccess(bid, 'native.image.height') || !deepAccess(bid, 'native.image.width')) {
return false;
}
}
if (deepAccess(bid, 'native.icon')) {
if (!deepAccess(bid, 'native.icon.height') || !deepAccess(bid, 'native.icon.width')) {
return false;
}
}

@gglas
Copy link

gglas commented Apr 26, 2021

Hey @guiann I think we'd be amenable to entertaining either of these :

  • should be valid since partners dont always provide icons width and height.
  • Or at least we can remove the check if values are not required ?

Would you be interested in proposing a direct code change and we can facilitate the PR ?

@guiann
Copy link
Contributor Author

guiann commented Apr 27, 2021

Sure., will do.

@guiann
Copy link
Contributor Author

guiann commented Apr 30, 2021

done: #6678

@ChrisHuie
Copy link
Collaborator

closing with #6678 contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants