Skip to content

Commit

Permalink
YahooAdvertising rebranding to Yahoo Ads. (#2872)
Browse files Browse the repository at this point in the history
Co-authored-by: oath-jac <dsp-supply-prebid@verizonmedia.com>
  • Loading branch information
radubarbos and oath-jac authored Jul 5, 2023
1 parent 14ae771 commit 230213d
Show file tree
Hide file tree
Showing 24 changed files with 85 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package yahooAdvertising
package yahooAds

import (
"encoding/json"
Expand All @@ -7,33 +7,33 @@ import (
"github.com/prebid/prebid-server/openrtb_ext"
)

// This file actually intends to test static/bidder-params/yahooAdvertising.json
// This file actually intends to test static/bidder-params/yahooAds.json
//
// These also validate the format of the external API: request.imp[i].ext.yahooAdvertising
// These also validate the format of the external API: request.imp[i].ext.yahooAds

// TestValidParams makes sure that the yahooAdvertising schema accepts all imp.ext fields which we intend to support.
// TestValidParams makes sure that the yahooAds schema accepts all imp.ext fields which we intend to support.
func TestValidParams(t *testing.T) {
validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params")
if err != nil {
t.Fatalf("Failed to fetch the json-schemas. %v", err)
}

for _, validParam := range validParams {
if err := validator.Validate(openrtb_ext.BidderYahooAdvertising, json.RawMessage(validParam)); err != nil {
t.Errorf("Schema rejected yahooAdvertising params: %s", validParam)
if err := validator.Validate(openrtb_ext.BidderYahooAds, json.RawMessage(validParam)); err != nil {
t.Errorf("Schema rejected yahooAds params: %s", validParam)
}
}
}

// TestInvalidParams makes sure that the yahooAdvertising schema rejects all the imp.ext fields we don't support.
// TestInvalidParams makes sure that the yahooAds schema rejects all the imp.ext fields we don't support.
func TestInvalidParams(t *testing.T) {
validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params")
if err != nil {
t.Fatalf("Failed to fetch the json-schemas. %v", err)
}

for _, invalidParam := range invalidParams {
if err := validator.Validate(openrtb_ext.BidderYahooAdvertising, json.RawMessage(invalidParam)); err == nil {
if err := validator.Validate(openrtb_ext.BidderYahooAds, json.RawMessage(invalidParam)); err == nil {
t.Errorf("Schema allowed unexpected params: %s", invalidParam)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package yahooAdvertising
package yahooAds

import (
"encoding/json"
Expand Down Expand Up @@ -41,8 +41,8 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.E
continue
}

var yahooAdvertisingExt openrtb_ext.ExtImpYahooAdvertising
err = json.Unmarshal(bidderExt.Bidder, &yahooAdvertisingExt)
var yahooAdsExt openrtb_ext.ExtImpYahooAds
err = json.Unmarshal(bidderExt.Bidder, &yahooAdsExt)
if err != nil {
err = &errortypes.BadInput{
Message: fmt.Sprintf("imp #%d: %s", idx, err.Error()),
Expand All @@ -64,7 +64,7 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.E
reqCopy.App = &appCopy
}

if err := changeRequestForBidService(&reqCopy, &yahooAdvertisingExt); err != nil {
if err := changeRequestForBidService(&reqCopy, &yahooAdsExt); err != nil {
errors = append(errors, err)
continue
}
Expand Down Expand Up @@ -150,7 +150,7 @@ func getImpInfo(impId string, imps []openrtb2.Imp) (bool, openrtb_ext.BidType) {
return exists, mediaType
}

func changeRequestForBidService(request *openrtb2.BidRequest, extension *openrtb_ext.ExtImpYahooAdvertising) error {
func changeRequestForBidService(request *openrtb2.BidRequest, extension *openrtb_ext.ExtImpYahooAds) error {
/* Always override the tag ID and (site ID or app ID) of the request */
request.Imp[0].TagID = extension.Pos
if request.Site != nil {
Expand Down Expand Up @@ -218,7 +218,7 @@ func validateBanner(banner *openrtb2.Banner) error {
return nil
}

// Builder builds a new instance of the YahooAdvertising adapter for the given bidder with the given config.
// Builder builds a new instance of the YahooAds adapter for the given bidder with the given config.
func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) {
bidder := &adapter{
URI: config.Endpoint,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package yahooAdvertising
package yahooAds

import (
"testing"
Expand All @@ -10,26 +10,26 @@ import (
"github.com/prebid/prebid-server/openrtb_ext"
)

func TestYahooAdvertisingBidderEndpointConfig(t *testing.T) {
bidder, buildErr := Builder(openrtb_ext.BidderYahooAdvertising, config.Adapter{
func TestYahooAdsBidderEndpointConfig(t *testing.T) {
bidder, buildErr := Builder(openrtb_ext.BidderYahooAds, config.Adapter{
Endpoint: "http://localhost/bid",
}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"})

if buildErr != nil {
t.Fatalf("Builder returned unexpected error %v", buildErr)
}

bidderYahooAdvertising := bidder.(*adapter)
bidderYahooAds := bidder.(*adapter)

assert.Equal(t, "http://localhost/bid", bidderYahooAdvertising.URI)
assert.Equal(t, "http://localhost/bid", bidderYahooAds.URI)
}

func TestJsonSamples(t *testing.T) {
bidder, buildErr := Builder(openrtb_ext.BidderYahooAdvertising, config.Adapter{}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"})
bidder, buildErr := Builder(openrtb_ext.BidderYahooAds, config.Adapter{}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"})

if buildErr != nil {
t.Fatalf("Builder returned unexpected error %v", buildErr)
}

adapterstest.RunJSONBidderTest(t, "yahooAdvertisingtest", bidder)
adapterstest.RunJSONBidderTest(t, "yahooAdstest", bidder)
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"id": "test-request-id",
"seatbid": [
{
"seat": "yahooAdvertising",
"seat": "yahooAds",
"bid": [{
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"id": "test-request-id",
"seatbid": [
{
"seat": "yahooAdvertising",
"seat": "yahooAds",
"bid": [{
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"id": "test-request-id",
"seatbid": [
{
"seat": "yahooAdvertising",
"seat": "yahooAds",
"bid": [{
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"id": "test-request-id",
"seatbid": [
{
"seat": "yahooAdvertising",
"seat": "yahooAds",
"bid": [{
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"id": "test-request-id",
"seatbid": [
{
"seat": "yahooAdvertising",
"seat": "yahooAds",
"bid": [{
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "wrong",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"id": "test-request-id",
"seatbid": [
{
"seat": "yahooAdvertising",
"seat": "yahooAds",
"bid": [{
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"id": "test-request-id",
"seatbid": [
{
"seat": "yahooAdvertising",
"seat": "yahooAds",
"bid": [{
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"id": "test-request-id",
"seatbid": [
{
"seat": "yahooAdvertising",
"seat": "yahooAds",
"bid": [{
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
Expand Down
7 changes: 4 additions & 3 deletions exchange/adapter_builders.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ import (
"github.com/prebid/prebid-server/adapters/visx"
"github.com/prebid/prebid-server/adapters/vrtcal"
"github.com/prebid/prebid-server/adapters/xeworks"
"github.com/prebid/prebid-server/adapters/yahooAdvertising"
"github.com/prebid/prebid-server/adapters/yahooAds"
"github.com/prebid/prebid-server/adapters/yeahmobi"
"github.com/prebid/prebid-server/adapters/yieldlab"
"github.com/prebid/prebid-server/adapters/yieldmo"
Expand Down Expand Up @@ -369,8 +369,9 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder {
openrtb_ext.BidderVisx: visx.Builder,
openrtb_ext.BidderVrtcal: vrtcal.Builder,
openrtb_ext.BidderXeworks: xeworks.Builder,
openrtb_ext.BidderYahooAdvertising: yahooAdvertising.Builder,
openrtb_ext.BidderYahooSSP: yahooAdvertising.Builder,
openrtb_ext.BidderYahooAds: yahooAds.Builder,
openrtb_ext.BidderYahooAdvertising: yahooAds.Builder,
openrtb_ext.BidderYahooSSP: yahooAds.Builder,
openrtb_ext.BidderYeahmobi: yeahmobi.Builder,
openrtb_ext.BidderYieldlab: yieldlab.Builder,
openrtb_ext.BidderYieldmo: yieldmo.Builder,
Expand Down
2 changes: 1 addition & 1 deletion exchange/adapter_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func GetDisabledBiddersErrorMessages(infos config.BidderInfos) map[string]string
"lifestreet": `Bidder "lifestreet" is no longer available in Prebid Server. Please update your configuration.`,
"adagio": `Bidder "adagio" is no longer available in Prebid Server. Please update your configuration.`,
"somoaudience": `Bidder "somoaudience" is no longer available in Prebid Server. Please update your configuration.`,
"yssp": `Bidder "yssp" is no longer available in Prebid Server. If you're looking to use the Yahoo SSP adapter, please rename it to "yahooAdvertising" in your configuration.`,
"yssp": `Bidder "yssp" is no longer available in Prebid Server. If you're looking to use the Yahoo SSP adapter, please rename it to "yahooAds" in your configuration.`,
"andbeyondmedia": `Bidder "andbeyondmedia" is no longer available in Prebid Server. If you're looking to use the AndBeyond.Media SSP adapter, please rename it to "beyondmedia" in your configuration.`,
"oftmedia": `Bidder "oftmedia" is no longer available in Prebid Server. Please update your configuration.`,
"groupm": `Bidder "groupm" is no longer available in Prebid Server. Please update your configuration.`,
Expand Down
8 changes: 4 additions & 4 deletions exchange/adapter_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func TestGetDisabledBiddersErrorMessages(t *testing.T) {
"lifestreet": `Bidder "lifestreet" is no longer available in Prebid Server. Please update your configuration.`,
"adagio": `Bidder "adagio" is no longer available in Prebid Server. Please update your configuration.`,
"somoaudience": `Bidder "somoaudience" is no longer available in Prebid Server. Please update your configuration.`,
"yssp": `Bidder "yssp" is no longer available in Prebid Server. If you're looking to use the Yahoo SSP adapter, please rename it to "yahooAdvertising" in your configuration.`,
"yssp": `Bidder "yssp" is no longer available in Prebid Server. If you're looking to use the Yahoo SSP adapter, please rename it to "yahooAds" in your configuration.`,
"andbeyondmedia": `Bidder "andbeyondmedia" is no longer available in Prebid Server. If you're looking to use the AndBeyond.Media SSP adapter, please rename it to "beyondmedia" in your configuration.`,
"oftmedia": `Bidder "oftmedia" is no longer available in Prebid Server. Please update your configuration.`,
"groupm": `Bidder "groupm" is no longer available in Prebid Server. Please update your configuration.`,
Expand All @@ -224,7 +224,7 @@ func TestGetDisabledBiddersErrorMessages(t *testing.T) {
"lifestreet": `Bidder "lifestreet" is no longer available in Prebid Server. Please update your configuration.`,
"adagio": `Bidder "adagio" is no longer available in Prebid Server. Please update your configuration.`,
"somoaudience": `Bidder "somoaudience" is no longer available in Prebid Server. Please update your configuration.`,
"yssp": `Bidder "yssp" is no longer available in Prebid Server. If you're looking to use the Yahoo SSP adapter, please rename it to "yahooAdvertising" in your configuration.`,
"yssp": `Bidder "yssp" is no longer available in Prebid Server. If you're looking to use the Yahoo SSP adapter, please rename it to "yahooAds" in your configuration.`,
"andbeyondmedia": `Bidder "andbeyondmedia" is no longer available in Prebid Server. If you're looking to use the AndBeyond.Media SSP adapter, please rename it to "beyondmedia" in your configuration.`,
"oftmedia": `Bidder "oftmedia" is no longer available in Prebid Server. Please update your configuration.`,
"groupm": `Bidder "groupm" is no longer available in Prebid Server. Please update your configuration.`,
Expand All @@ -238,7 +238,7 @@ func TestGetDisabledBiddersErrorMessages(t *testing.T) {
"lifestreet": `Bidder "lifestreet" is no longer available in Prebid Server. Please update your configuration.`,
"adagio": `Bidder "adagio" is no longer available in Prebid Server. Please update your configuration.`,
"somoaudience": `Bidder "somoaudience" is no longer available in Prebid Server. Please update your configuration.`,
"yssp": `Bidder "yssp" is no longer available in Prebid Server. If you're looking to use the Yahoo SSP adapter, please rename it to "yahooAdvertising" in your configuration.`,
"yssp": `Bidder "yssp" is no longer available in Prebid Server. If you're looking to use the Yahoo SSP adapter, please rename it to "yahooAds" in your configuration.`,
"appnexus": `Bidder "appnexus" has been disabled on this instance of Prebid Server. Please work with the PBS host to enable this bidder again.`,
"andbeyondmedia": `Bidder "andbeyondmedia" is no longer available in Prebid Server. If you're looking to use the AndBeyond.Media SSP adapter, please rename it to "beyondmedia" in your configuration.`,
"oftmedia": `Bidder "oftmedia" is no longer available in Prebid Server. Please update your configuration.`,
Expand All @@ -253,7 +253,7 @@ func TestGetDisabledBiddersErrorMessages(t *testing.T) {
"lifestreet": `Bidder "lifestreet" is no longer available in Prebid Server. Please update your configuration.`,
"adagio": `Bidder "adagio" is no longer available in Prebid Server. Please update your configuration.`,
"somoaudience": `Bidder "somoaudience" is no longer available in Prebid Server. Please update your configuration.`,
"yssp": `Bidder "yssp" is no longer available in Prebid Server. If you're looking to use the Yahoo SSP adapter, please rename it to "yahooAdvertising" in your configuration.`,
"yssp": `Bidder "yssp" is no longer available in Prebid Server. If you're looking to use the Yahoo SSP adapter, please rename it to "yahooAds" in your configuration.`,
"appnexus": `Bidder "appnexus" has been disabled on this instance of Prebid Server. Please work with the PBS host to enable this bidder again.`,
"andbeyondmedia": `Bidder "andbeyondmedia" is no longer available in Prebid Server. If you're looking to use the AndBeyond.Media SSP adapter, please rename it to "beyondmedia" in your configuration.`,
"oftmedia": `Bidder "oftmedia" is no longer available in Prebid Server. Please update your configuration.`,
Expand Down
2 changes: 2 additions & 0 deletions openrtb_ext/bidders.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ const (
BidderVisx BidderName = "visx"
BidderVrtcal BidderName = "vrtcal"
BidderXeworks BidderName = "xeworks"
BidderYahooAds BidderName = "yahooAds"
BidderYahooAdvertising BidderName = "yahooAdvertising"
BidderYahooSSP BidderName = "yahoossp"
BidderYeahmobi BidderName = "yeahmobi"
Expand Down Expand Up @@ -467,6 +468,7 @@ func CoreBidderNames() []BidderName {
BidderVisx,
BidderVrtcal,
BidderXeworks,
BidderYahooAds,
BidderYahooAdvertising,
BidderYahooSSP,
BidderYeahmobi,
Expand Down
2 changes: 1 addition & 1 deletion openrtb_ext/bidders_validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestBidderUniquenessGatekeeping(t *testing.T) {
// - Exclude duplicates of adapters for the same bidder, as it's unlikely a publisher will use both.
var bidders []string
for _, bidder := range CoreBidderNames() {
if bidder != BidderTripleliftNative && bidder != BidderAdkernelAdn && bidder != BidderFreewheelSSPOld {
if bidder != BidderTripleliftNative && bidder != BidderAdkernelAdn && bidder != BidderFreewheelSSPOld && bidder != BidderYahooAdvertising {
bidders = append(bidders, string(bidder))
}
}
Expand Down
7 changes: 7 additions & 0 deletions openrtb_ext/imp_yahooAds.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package openrtb_ext

// ExtImpYahooAds defines the contract for bidrequest.imp[i].ext.prebid.bidder.yahooAds
type ExtImpYahooAds struct {
Dcn string `json:"dcn"`
Pos string `json:"pos"`
}
18 changes: 18 additions & 0 deletions static/bidder-info/yahooAds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
endpoint: "https://s2shb.ssp.yahoo.com/admax/bid/partners/PBS"
maintainer:
email: "hb-fe-tech@yahooinc.com"
gvlVendorID: 25
capabilities:
app:
mediaTypes:
- banner
- video
site:
mediaTypes:
- banner
- video
userSync:
# yahooAds supports user syncing, but requires configuration by the host. contact this
# bidder directly at the email address in this file to ask about enabling user sync.
supports:
- redirect
19 changes: 19 additions & 0 deletions static/bidder-params/yahooAds.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "YahooAds Adapter Params",
"description": "A schema which validates params accepted by the YahooAds adapter",
"type": "object",
"properties": {
"dcn": {
"type": "string",
"minLength": 1,
"description": "Site ID provided by One Mobile"
},
"pos": {
"type": "string",
"minLength": 1,
"description": "Placement ID"
}
},
"required": ["dcn", "pos"]
}

0 comments on commit 230213d

Please sign in to comment.