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

Validatiors not conforming to IAB specifications ? #78

Open
renomarx opened this issue Feb 11, 2021 · 2 comments
Open

Validatiors not conforming to IAB specifications ? #78

renomarx opened this issue Feb 11, 2021 · 2 comments

Comments

@renomarx
Copy link

Hello,

I think there are some contradictions with IAB OpenRTB specifications on validators:

For example, in IAB specifications, it seems that an imp object can contain a video object and/or a banner object.

The presence of a Videoas a subordinate ofthe Impobject indicates that this impression is offered as a video type impression. At the publisher’s discretion, that same impression may also be offered as banner, audio, and/or native by also including as Impsubordinates objects of those types. However, any given bid for the impression must conform to one of the offered types.

Source: https://www.iab.com/wp-content/uploads/2016/03/OpenRTB-API-Specification-Version-2-5-FINAL.pdf

But here is the code of the validator:


func (imp *Impression) assetCount() int {
	n := 0
	if imp.Banner != nil {
		n++
	}
	if imp.Video != nil {
		n++
	}
	if imp.Native != nil {
		n++
	}
	return n
}

// Validate the `imp` object
func (imp *Impression) Validate() error {
	if imp.ID == "" {
		return ErrInvalidImpNoID
	}

	if count := imp.assetCount(); count > 1 {
		return ErrInvalidImpMultiAssets
	}

	if imp.Video != nil {
		if err := imp.Video.Validate(); err != nil {
			return err
		}
	}

	return nil
}

Is there any particular reason for that behavior ?

@dim
Copy link
Member

dim commented Feb 12, 2021

Good point, do you mind adding a pull request to address?

@renomarx
Copy link
Author

Sure, I'll do that by the end of next week.

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

No branches or pull requests

2 participants