Skip to content

New Adapter: Aniview - #4852

Open
roshecode wants to merge 5 commits into
prebid:masterfrom
Aniview:master
Open

New Adapter: Aniview#4852
roshecode wants to merge 5 commits into
prebid:masterfrom
Aniview:master

Conversation

@roshecode

Copy link
Copy Markdown

Comment thread adapters/aniview/aniview.go Outdated

for _, imp := range request.Imp {
if imp.ID == bid.ImpID {
if imp.Video != nil {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider this as a suggestion. The current implementation follows an anti-pattern, assumes that if there is a multi-format request, the media type defaults to openrtb_ext.BidTypeVideo, nil. Prebid server expects the media type to be explicitly set in the adapter response. Therefore, we strongly recommend implementing a pattern where the adapter server sets the MType field in the response to accurately determine the media type for the impression.

Comment thread adapters/aniview/aniview.go Outdated
if imp.Video != nil {
return openrtb_ext.BidTypeVideo, nil
}
if imp.Banner != nil {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider this as a suggestion. The current implementation follows an anti-pattern, assumes that if there is a multi-format request, the media type defaults to openrtb_ext.BidTypeBanner, nil. Prebid server expects the media type to be explicitly set in the adapter response. Therefore, we strongly recommend implementing a pattern where the adapter server sets the MType field in the response to accurately determine the media type for the impression.

endpoint: "https://rtb.aniview.com/sspRTB2"
maintainer:
email: "support@aniview.com"
gvlVendorID: 780

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verifed:

Image

@@ -0,0 +1,18 @@
endpoint: "https://rtb.aniview.com/sspRTB2"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works

Image

@@ -0,0 +1,18 @@
endpoint: "https://rtb.aniview.com/sspRTB2"
maintainer:
email: "support@aniview.com"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting for response

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Comment thread adapters/aniview/aniview.go Outdated
var requests []*adapters.RequestData
var errors []error

headers := http.Header{}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http.Header is a map[string][]string — a reference type. Creating it once outside the loop and assigning it to every RequestData.Headers means all outgoing requests share the same map. If PBS or any middleware mutates one request's headers (e.g. adds a correlation ID), it silently modifies every other request in the batch.

Please create a fresh http.Header{} per RequestData, inside the inner loop:

headers := http.Header{}
headers.Add("Content-Type", "application/json;charset=utf-8")
headers.Add("Accept", "application/json")
requests = append(requests, &adapters.RequestData{
    ...
    Headers: headers,
})

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

return nil, &errortypes.BadInput{
Message: fmt.Sprintf("Missing AV_CHANNELID for imp: %s", imp.ID),
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adapters.CheckResponseStatusCodeForErrors already returns the right typed error — BadInput for 400 and BadServerResponse for everything else (500, 503, etc.). The current code discards that typed error and always wraps a new errortypes.BadInput, so a 500 response from the exchange is misclassified as a buyer error.

Please just propagate the helper's return value:
if err := adapters.CheckResponseStatusCodeForErrors(responseData); err != nil {
return nil, []error{err}
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

"minLength": 1
}
},
"required": [

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PBS convention requires "additionalProperties": false in every bidder-params schema. Without it the validator silently accepts objects with misspelled or unknown fields (e.g. "AV_CHANNELID_TYPO": "…" passes validation even though the adapter never reads it).

Please add it after the required block:
"required": ["AV_PUBLISHERID", "AV_CHANNELID"],
"additionalProperties": false

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@github-actions

Copy link
Copy Markdown

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 6674c18

aniview

Refer here for heat map coverage report

github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:26:	Builder			100.0%
github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:33:	MakeRequests		87.5%
github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:82:	buildRequestExt		88.9%
github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:101:	splitImpByMediaType	100.0%
github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:113:	extractImpExt		88.9%
github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:132:	MakeBids		100.0%
github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:188:	getMediaTypeForBid	100.0%
total:									(statements)		93.6%

@przemkaczmarek przemkaczmarek self-assigned this Jul 16, 2026
@roshecode

Copy link
Copy Markdown
Author

@przemkaczmarek thanks for the review. All the issues have been resolved.

przemkaczmarek
przemkaczmarek previously approved these changes Jul 20, 2026
@github-actions

Copy link
Copy Markdown

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 4b88248

aniview

Refer here for heat map coverage report

github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:26:	Builder			100.0%
github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:33:	MakeRequests		87.5%
github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:84:	buildRequestExt		88.9%
github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:103:	splitImpByMediaType	100.0%
github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:115:	extractImpExt		88.9%
github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:134:	MakeBids		100.0%
github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:188:	getMediaTypeForBid	100.0%
total:									(statements)		93.6%

@floxis-admin floxis-admin left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing as another adapter submitter. One issue, plus a follow-on that's specific to your param naming.

"additionalProperties": false in static/bidder-params/aniview.json aborts the whole auction, not just your bidder

A bidder-params schema failure returns a plain fmt.Errorf at ortb/request_validator.go:133. errortypes.isFatal treats any error not implementing Coder as fatal (return !ok || ...), so endpoints/openrtb2/auction.go:935 hits ContainsFatalError and returns immediately — the entire bid request 400s for every bidder on the page. Every sibling branch in that same function does the soft thing instead (append(errL, ...) + delete(prebid.Bidder, bidder)); the schema path is the one that's fatal.

So any publisher who carries one extra key in bid.params loses their whole auction. Prebid.js copies bid.params verbatim into imp.ext.prebid.bidder.aniview under s2s, so extra keys are common. Only 2 of 269 schemas on master set this. (We shipped the same thing and it went unnoticed for weeks — that's why I spotted it.)

If you drop it, watch out for the case-sensitivity gap — it bites your params harder than most

Your params are AV_PUBLISHERID / AV_CHANNELID. JSON Schema property names are case-sensitive, but Go's JSON unmarshalling is case-insensitive. Today additionalProperties: false is what rejects av_publisherid; once it's gone, that key passes schema validation untouched (it matches no declared property, so minLength: 1 never runs) and Go still binds it into your struct.

That's mostly harmless for an ID, but it means the schema's minLength/required guarantees quietly stop applying to any case variant. Worth a non-empty check on both fields in MakeRequests after unmarshal if you drop the flag. We hit precisely this — in our case the ungated value was interpolated into a hostname, which was a good deal worse.

@roshecode

Copy link
Copy Markdown
Author

@przemkaczmarek you asked me to add "additionalProperties": false here. @floxis-admin flagged it as harmful, and after checking the code I agree, so I've removed it. Quick summary of why, since you requested it originally.

One unrecognised key in bid.params costs the publisher their whole auction, for every bidder on the page - not just Aniview. Every sibling branch in that same loop handles bad input softly instead. Since Prebid.js copies bid.params verbatim into imp.ext.prebid.bidder.aniview under s2s, extra keys reach us in normal operation. For what it's worth, only 2 of 267 schemas in static/bidder-params/ set this flag.

required and minLength still cover the cases that matter for us. Happy to revisit if you'd rather keep it - let me know.

@floxis-admin thanks, good catch on additionalProperties, I've dropped it.

On the case-sensitivity follow-on, one correction and then a reason I don't think the extra checks buy us anything.

The correction: additionalProperties: false isn't what rejects av_publisherid - required does, and it's case-sensitive on its own. With the flag removed::

{"av_publisherid":"p","av_channelid":"c"}
  -> REJECTED: (root): AV_PUBLISHERID is required
               (root): AV_CHANNELID is required

A lowercase-only payload never reaches the adapter either way, so removing the flag opens no hole there.

Where you're right: the gap is a payload carrying both casings, and there minLength: 1 genuinely stops applying:

{"AV_PUBLISHERID":"p","AV_CHANNELID":"good","av_channelid":""}         -> PASSES schema; binds ChannelId=""
{"AV_PUBLISHERID":"p","AV_CHANNELID":"good","av_channelid":"   "}      -> PASSES schema; binds ChannelId="   "
{"AV_PUBLISHERID":"p","AV_CHANNELID":"good","av_channelid":"OVERRIDE"} -> PASSES schema; binds ChannelId="OVERRIDE"

required is satisfied by the correctly-cased key, the duplicate matches no declared property so minLength never runs on it, and jsoniter's case-insensitive binding lets the lowercase one win.

Why no new check: extractImpExt already does strings.TrimSpace(impExt.ChannelId) == "", which covers exactly the cases where the schema guarantee lapses. End-to-end through MakeRequests:

AV_CHANNELID:"good" + av_channelid:""         -> 0 requests, [Missing AV_CHANNELID for imp: imp1]
AV_CHANNELID:"good" + av_channelid:"   "      -> 0 requests, [Missing AV_CHANNELID for imp: imp1]
AV_CHANNELID:"good" + av_channelid:"OVERRIDE" -> 1 request,  tagid="OVERRIDE"

So the non-empty guarantee is already restored for the field we actually use. AV_PUBLISHERID needs no equivalent because it isn't forwarded anywhere after an earlier commit in this PR (it is used for debugging purposes).

@github-actions

Copy link
Copy Markdown

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 2e86eaf

aniview

Refer here for heat map coverage report

github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:26:	Builder			100.0%
github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:33:	MakeRequests		87.5%
github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:84:	buildRequestExt		88.9%
github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:103:	splitImpByMediaType	100.0%
github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:115:	extractImpExt		88.9%
github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:134:	MakeBids		100.0%
github.com/prebid/prebid-server/v4/adapters/aniview/aniview.go:188:	getMediaTypeForBid	100.0%
total:									(statements)		93.6%

@roshecode

Copy link
Copy Markdown
Author

@floxis-admin please check my previous message when you have time. Thanks!

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 this pull request may close these issues.

3 participants