Switch from custom RawJSON to json.RawMessage

https://github.com/mxmCherry/openrtb/issues/23
This commit is contained in:
Max Cherry
2018-03-03 09:49:12 +02:00
parent c426d335a3
commit fd8bfbb100
45 changed files with 139 additions and 299 deletions
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.14 Object: App
//
// This object should be included if the ad supported content is a non-browser application (typically in mobile) as opposed to a website.
@@ -130,5 +132,5 @@ type App struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.8 Object: Audio
//
// This object represents an audio type impression.
@@ -178,5 +180,5 @@ type Audio struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.6 Object: Banner
//
// This object represents the most general type of impression.
@@ -165,5 +167,5 @@ type Banner struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 4.2.3 Object: Bid
//
// A SeatBid object contains one or more Bid objects, each of which relates to a specific impression in the bid request via the impid attribute and constitutes an offer to buy that impression for a given price.
@@ -273,5 +275,5 @@ type Bid struct {
// object
// Description:
// Placeholder for bidder-specific extensions to OpenRTB
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.1 Object: BidRequest
//
// The top-level bid request object contains a globally unique bid request or auction ID.
@@ -205,5 +207,5 @@ type BidRequest struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 4.2.1 Object: BidResponse
//
// This object is the top-level bid response object (i.e., the unnamed outer JSON object).
@@ -70,5 +72,5 @@ type BidResponse struct {
// object
// Description:
// Placeholder for bidder-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.16 Object: Content
//
// This object describes the content in which the impression will appear, which may be syndicated or nonsyndicated content.
@@ -226,5 +228,5 @@ type Content struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.21 Object: Data
//
// The data and segment objects together allow additional data about the related object (e.g., user, content) to be specified.
@@ -39,5 +41,5 @@ type Data struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.12 Object: Deal
//
// This object constitutes a specific deal that was struck a priori between a buyer and a seller.
@@ -70,5 +72,5 @@ type Deal struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.18 Object: Device
//
// This object provides information pertaining to the device through which the user is interacting.
@@ -271,5 +273,5 @@ type Device struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.10 Object: Format
//
// This object represents an allowed size (i.e., height and width combination) or Flex Ad parameters for a banner impression.
@@ -54,5 +56,5 @@ type Format struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.19 Object: Geo
//
// This object encapsulates various methods for specifying a geographic location.
@@ -133,5 +135,5 @@ type Geo struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.4 Object: Imp
//
// This object describes an ad placement or impression being auctioned.
@@ -176,5 +178,5 @@ type Imp struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.5 Object: Metric
//
// This object is associated with an impression as an array of metrics.
@@ -42,5 +44,5 @@ type Metric struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.9 Object: Native
//
// This object represents a native type impression.
@@ -57,5 +59,5 @@ type Native struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package request
import "encoding/json"
// 4.2 Asset Object
//
// The main container object for each asset requested or supported by Exchange on behalf of the rendering client.
@@ -99,5 +101,5 @@ type Asset struct {
// object
// Description:
// This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility beyond the standard defined in this specification
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+6 -2
View File
@@ -1,6 +1,10 @@
package request
import "github.com/mxmCherry/openrtb/native"
import (
"encoding/json"
"github.com/mxmCherry/openrtb/native"
)
// 4.6 Data Object
//
@@ -39,5 +43,5 @@ type Data struct {
// object
// Description:
// This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility beyond the standard defined in this specification
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+6 -2
View File
@@ -1,6 +1,10 @@
package request
import "github.com/mxmCherry/openrtb/native"
import (
"encoding/json"
"github.com/mxmCherry/openrtb/native"
)
// 4.7 Event Trackers Request Object
//
@@ -37,5 +41,5 @@ type EventTracker struct {
// object
// Description:
// This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility beyond the standard defined in this specification
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+6 -2
View File
@@ -1,6 +1,10 @@
package request
import "github.com/mxmCherry/openrtb/native"
import (
"encoding/json"
"github.com/mxmCherry/openrtb/native"
)
// 4.4 Image Object
//
@@ -90,5 +94,5 @@ type Image struct {
// object
// Description:
// This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility beyond the standard defined in this specification
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
-27
View File
@@ -1,27 +0,0 @@
package request
import "errors"
// RawJSON is a raw encoded JSON value.
// It implements encoding/json.Marshaler and encoding/json.Unmarshaler and can
// be used to delay JSON decoding or precompute a JSON encoding.
//
// Basically, it's just a copy of encoding/json.RawMessage type,
// but with more convenient non-pointer encoding.
//
// HEADS UP: this will be replaced with json.RawMessage when Go 1.10 is out.
type RawJSON []byte
// MarshalJSON returns m as the JSON encoding of m.
func (m RawJSON) MarshalJSON() ([]byte, error) {
return m, nil
}
// UnmarshalJSON sets *m to a copy of data.
func (m *RawJSON) UnmarshalJSON(data []byte) error {
if m == nil {
return errors.New("openrtb/native/request.RawJSON: UnmarshalJSON on nil pointer")
}
*m = append((*m)[0:0], data...)
return nil
}
-57
View File
@@ -1,57 +0,0 @@
package request_test
import (
"encoding/json"
. "github.com/mxmCherry/openrtb/native/response"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("RawJSON", func() {
var _ json.Marshaler = (RawJSON)(nil)
var _ json.Unmarshaler = (*RawJSON)(nil)
It("should encode JSON", func() {
subject := RawJSON(`true`)
actual, err := subject.MarshalJSON()
Expect(err).NotTo(HaveOccurred())
Expect(actual).To(Equal([]byte(`true`)))
})
It("should decode JSON", func() {
subject := RawJSON(nil)
err := subject.UnmarshalJSON([]byte(`true`))
Expect(err).NotTo(HaveOccurred())
Expect(subject).To(Equal(RawJSON(`true`)))
})
It("should decode JSON when embedded into struct", func() {
wrapper := struct {
Raw RawJSON `json:"raw"`
}{
Raw: nil,
}
err := json.Unmarshal([]byte(`{"raw":true}`), &wrapper)
Expect(err).NotTo(HaveOccurred())
Expect(wrapper.Raw).To(Equal(RawJSON(`true`)))
})
It("should encode JSON when embedded into struct", func() {
wrapper := struct {
Raw RawJSON `json:"raw"`
}{
Raw: RawJSON(`true`),
}
actual, err := json.Marshal(wrapper)
Expect(err).NotTo(HaveOccurred())
Expect(actual).To(MatchJSON(`{"raw":true}`))
})
})
+6 -2
View File
@@ -4,7 +4,11 @@
// https://www.iab.com/wp-content/uploads/2018/03/OpenRTB-Native-Ads-Specification-Final-1.2.pdf
package request
import "github.com/mxmCherry/openrtb/native"
import (
"encoding/json"
"github.com/mxmCherry/openrtb/native"
)
// 4.1 Native Markup Request Object
//
@@ -179,5 +183,5 @@ type Request struct {
// object
// Description:
// This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility beyond the standard defined in this specification
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package request
import "encoding/json"
// 4.3 Title Object
//
// The Title object is to be used for title element of the Native ad.
@@ -23,5 +25,5 @@ type Title struct {
// object
// Description:
// This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility beyond the standard defined in this specification
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package request
import "encoding/json"
// 4.5 Video Object
//
// The video object to be used for all video elements supported in the Native Ad.
@@ -59,5 +61,5 @@ type Video struct {
// object
// Description:
// This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility beyond the standard defined in this specification
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package response
import "encoding/json"
// 5.2 Object: Asset
//
// Corresponds to the Asset Object in the request. The main container object for each asset
@@ -97,5 +99,5 @@ type Asset struct {
// This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility beyond the standard defined in this specification
// Bidders are encouraged not to use asset.ext for exchanging text assets.
// Use data.ext with custom type instead.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+6 -2
View File
@@ -1,6 +1,10 @@
package response
import "github.com/mxmCherry/openrtb/native"
import (
"encoding/json"
"github.com/mxmCherry/openrtb/native"
)
// 5.5 Object: Data
//
@@ -60,5 +64,5 @@ type Data struct {
// object
// Description:
// This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility beyond the standard defined in this specification
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+7 -3
View File
@@ -1,6 +1,10 @@
package response
import "github.com/mxmCherry/openrtb/native"
import (
"encoding/json"
"github.com/mxmCherry/openrtb/native"
)
// 5.8 Event Tracker Response Object
//
@@ -53,7 +57,7 @@ type EventTracker struct {
// Dev note:
// - type is a key-value object (not specified if value is string-only)
// - descriptions says "an array of key:value objects" (???)
CustomData RawJSON `json:"customdata,omitempty"`
CustomData json.RawMessage `json:"customdata,omitempty"`
// Field:
// ext
@@ -63,5 +67,5 @@ type EventTracker struct {
// object
// Description:
// This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility beyond the standard defined in this specification
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+6 -2
View File
@@ -1,6 +1,10 @@
package response
import "github.com/mxmCherry/openrtb/native"
import (
"encoding/json"
"github.com/mxmCherry/openrtb/native"
)
// 5.4 Object: Image
//
@@ -62,5 +66,5 @@ type Image struct {
// object
// Description:
// This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility beyond the standard defined in this specification
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package response
import "encoding/json"
// 5.7 Object: Link
//
// Used for call to action assets, or other links from the Native ad.
@@ -45,5 +47,5 @@ type Link struct {
// object
// Description:
// This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility beyond the standard defined in this specification
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
-27
View File
@@ -1,27 +0,0 @@
package response
import "errors"
// RawJSON is a raw encoded JSON value.
// It implements encoding/json.Marshaler and encoding/json.Unmarshaler and can
// be used to delay JSON decoding or precompute a JSON encoding.
//
// Basically, it's just a copy of encoding/json.RawMessage type,
// but with more convenient non-pointer encoding.
//
// HEADS UP: this will be replaced with json.RawMessage when Go 1.10 is out.
type RawJSON []byte
// MarshalJSON returns m as the JSON encoding of m.
func (m RawJSON) MarshalJSON() ([]byte, error) {
return m, nil
}
// UnmarshalJSON sets *m to a copy of data.
func (m *RawJSON) UnmarshalJSON(data []byte) error {
if m == nil {
return errors.New("openrtb/native/response.RawJSON: UnmarshalJSON on nil pointer")
}
*m = append((*m)[0:0], data...)
return nil
}
-57
View File
@@ -1,57 +0,0 @@
package response_test
import (
"encoding/json"
. "github.com/mxmCherry/openrtb/native/response"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("RawJSON", func() {
var _ json.Marshaler = (RawJSON)(nil)
var _ json.Unmarshaler = (*RawJSON)(nil)
It("should encode JSON", func() {
subject := RawJSON(`true`)
actual, err := subject.MarshalJSON()
Expect(err).NotTo(HaveOccurred())
Expect(actual).To(Equal([]byte(`true`)))
})
It("should decode JSON", func() {
subject := RawJSON(nil)
err := subject.UnmarshalJSON([]byte(`true`))
Expect(err).NotTo(HaveOccurred())
Expect(subject).To(Equal(RawJSON(`true`)))
})
It("should decode JSON when embedded into struct", func() {
wrapper := struct {
Raw RawJSON `json:"raw"`
}{
Raw: nil,
}
err := json.Unmarshal([]byte(`{"raw":true}`), &wrapper)
Expect(err).NotTo(HaveOccurred())
Expect(wrapper.Raw).To(Equal(RawJSON(`true`)))
})
It("should encode JSON when embedded into struct", func() {
wrapper := struct {
Raw RawJSON `json:"raw"`
}{
Raw: RawJSON(`true`),
}
actual, err := json.Marshal(wrapper)
Expect(err).NotTo(HaveOccurred())
Expect(actual).To(MatchJSON(`{"raw":true}`))
})
})
+3 -1
View File
@@ -4,6 +4,8 @@
// https://www.iab.com/wp-content/uploads/2018/03/OpenRTB-Native-Ads-Specification-Final-1.2.pdf
package response
import "encoding/json"
// 5.1 Object: Response
//
// The native object is the top level JSON object which identifies a native response.
@@ -138,5 +140,5 @@ type Response struct {
// object
// Description:
// This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility beyond the standard defined in this specification
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package response
import "encoding/json"
// 5.3 Object: Title
//
// Corresponds to the Title Object in the request, with the value filled in.
@@ -35,5 +37,5 @@ type Title struct {
// object
// Description:
// This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility beyond the standard defined in this specification
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.11 Object: Pmp
//
// This object is the private marketplace container for direct deals between buyers and sellers that may pertain to this impression.
@@ -32,5 +34,5 @@ type PMP struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.17 Object: Producer
//
// This object defines the producer of the content in which the ad will be shown.
@@ -47,5 +49,5 @@ type Producer struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.15 Object: Publisher
//
// This object describes the publisher of the media in which the ad will be displayed.
@@ -45,5 +47,5 @@ type Publisher struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
-27
View File
@@ -1,27 +0,0 @@
package openrtb
import "errors"
// RawJSON is a raw encoded JSON value.
// It implements encoding/json.Marshaler and encoding/json.Unmarshaler and can
// be used to delay JSON decoding or precompute a JSON encoding.
//
// Basically, it's just a copy of encoding/json.RawMessage type,
// but with more convenient non-pointer encoding.
//
// HEADS UP: this will be replaced with json.RawMessage when Go 1.10 is out.
type RawJSON []byte
// MarshalJSON returns m as the JSON encoding of m.
func (m RawJSON) MarshalJSON() ([]byte, error) {
return m, nil
}
// UnmarshalJSON sets *m to a copy of data.
func (m *RawJSON) UnmarshalJSON(data []byte) error {
if m == nil {
return errors.New("openrtb.RawJSON: UnmarshalJSON on nil pointer")
}
*m = append((*m)[0:0], data...)
return nil
}
-57
View File
@@ -1,57 +0,0 @@
package openrtb_test
import (
"encoding/json"
. "github.com/mxmCherry/openrtb"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("RawJSON", func() {
var _ json.Marshaler = (RawJSON)(nil)
var _ json.Unmarshaler = (*RawJSON)(nil)
It("should encode JSON", func() {
subject := RawJSON(`true`)
actual, err := subject.MarshalJSON()
Expect(err).NotTo(HaveOccurred())
Expect(actual).To(Equal([]byte(`true`)))
})
It("should decode JSON", func() {
subject := RawJSON(nil)
err := subject.UnmarshalJSON([]byte(`true`))
Expect(err).NotTo(HaveOccurred())
Expect(subject).To(Equal(RawJSON(`true`)))
})
It("should decode JSON when embedded into struct", func() {
wrapper := struct {
Raw RawJSON `json:"raw"`
}{
Raw: nil,
}
err := json.Unmarshal([]byte(`{"raw":true}`), &wrapper)
Expect(err).NotTo(HaveOccurred())
Expect(wrapper.Raw).To(Equal(RawJSON(`true`)))
})
It("should encode JSON when embedded into struct", func() {
wrapper := struct {
Raw RawJSON `json:"raw"`
}{
Raw: RawJSON(`true`),
}
actual, err := json.Marshal(wrapper)
Expect(err).NotTo(HaveOccurred())
Expect(actual).To(MatchJSON(`{"raw":true}`))
})
})
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.3 Object: Regs
//
// This object contains any legal, governmental, or industry regulations that apply to the request.
@@ -22,5 +24,5 @@ type Regs struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 4.2.2 Object: SeatBid
//
// A bid response can contain multiple SeatBid objects, each on behalf of a different bidder seat and each containing one or more individual bids.
@@ -39,5 +41,5 @@ type SeatBid struct {
// object
// Description:
// Placeholder for bidder-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.22 Object: Segment
//
// Segment objects are essentially key-value pairs that convey specific units of data.
@@ -37,5 +39,5 @@ type Segment struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.13 Object: Site
//
// This object should be included if the ad supported content is a website as opposed to a non-browser application.
@@ -128,5 +130,5 @@ type Site struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.2 Object: Source
//
// This object describes the nature and behavior of the entity that is the source of the bid request upstream from the exchange.
@@ -40,5 +42,5 @@ type Source struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.20 Object: User
//
// This object contains information known or derived about the human user of the device (i.e., the audience for advertising).
@@ -85,5 +87,5 @@ type User struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}
+3 -1
View File
@@ -1,5 +1,7 @@
package openrtb
import "encoding/json"
// 3.2.7 Object: Video
//
// This object represents an in-stream video impression.
@@ -261,5 +263,5 @@ type Video struct {
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext RawJSON `json:"ext,omitempty"`
Ext json.RawMessage `json:"ext,omitempty"`
}