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

fix(openrtb): convert extension type from interface to json raw message #96

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.12

require (
github.com/go-test/deep v1.0.4
github.com/google/go-cmp v0.5.6
github.com/mailru/easyjson v0.7.7
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 // indirect
)
7 changes: 7 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
github.com/go-test/deep v1.0.4 h1:u2CU3YKy9I2pmu9pX0eq50wCgjfGIt539SqR7FbHiho=
github.com/go-test/deep v1.0.4/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/mailru/easyjson v0.7.1 h1:mdxE1MF9o53iCb2Ghj1VfWvh7ZOwHpnVG/xwXrV90U8=
github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
Expand All @@ -18,3 +24,4 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7 h1:EBZoQjiKKPaLbPrbpssUfuHtwM6KV/vb4U85g/cigFY=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
10 changes: 7 additions & 3 deletions openrtb/application.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package openrtb

import "github.com/Vungle/vungo/internal/util"
import (
"encoding/json"

"github.com/Vungle/vungo/internal/util"
)

// Application object should be included if the ad supported content is a
// non-browser application (typically in mobile) as opposed to a website.
Expand Down Expand Up @@ -134,7 +138,7 @@ type Application struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Extension interface{} `json:"ext,omitempty"`
Extension json.RawMessage `json:"ext,omitempty"`
}

// Validate method checks to see if the Application object contains required and well-formatted data
Expand Down Expand Up @@ -171,7 +175,7 @@ func (a *Application) Copy() *Application {
appCopy.Publisher = a.Publisher.Copy()
appCopy.Content = a.Content.Copy()

appCopy.Extension = util.DeepCopyCopiable(a.Extension)
appCopy.Extension = util.DeepCopyJSONRawMsg(a.Extension)

return &appCopy
}
90 changes: 20 additions & 70 deletions openrtb/application_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions openrtb/audio.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package openrtb

import (
"encoding/json"
"errors"

"github.com/Vungle/vungo/internal/util"
Expand Down Expand Up @@ -185,7 +186,7 @@ type Audio struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Extension interface{} `json:"ext,omitempty"`
Extension json.RawMessage `json:"ext,omitempty"`
}

// Validate method implements a Validater interface and return a validation error according to the
Expand Down Expand Up @@ -249,7 +250,7 @@ func (a *Audio) Copy() *Audio {
copy(vCopy.CompanionTypes, a.CompanionTypes)
}

vCopy.Extension = util.DeepCopyCopiable(a.Extension)
vCopy.Extension = util.DeepCopyJSONRawMsg(a.Extension)

return &vCopy
}
54 changes: 12 additions & 42 deletions openrtb/audio_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading