mirror of
https://github.com/prebid/openrtb.git
synced 2026-06-15 14:36:36 +03:00
768e1b18756adca6ac059a8b335f97da4facfe54
go-rtb
Common OpenRTB v2.3 Object types for Go programming language
Warning! Currently, this package is quite unstable (types and names may change). Also, even after v1.0 this repo will contain only recent version (v1+). So, if you need to use this code in production, take a look on godep.
Progress
- 3.2 Object Specifications
- 3.2.1 Object: BidRequest
- 3.2.2 Object: Imp
- 3.2.3 Object: Banner
- 3.2.4 Object: Video
- 3.2.5 Object: Native
- 3.2.6 Object: Site
- 3.2.7 Object: App
- 3.2.8 Object: Publisher
- 3.2.9 Object: Content
- 3.2.10 Object: Producer
- 3.2.11 Object: Device
- 3.2.12 Object: Geo
- 3.2.13 Object: User
- 3.2.14 Object: Data
- 3.2.15 Object: Segment
- 3.2.16 Object: Regs
- 3.2.17 Object: Pmp
- 3.2.18 Object: Deal
- 4.2 Object Specifications
- 4.2.1 Object: BidResponse
- 4.2.2 Object: SeatBid
- 4.2.3 Object: Bid
- Code quality/review
- Review struct key types, which refer to section "5. Enumerated Lists Specification"
- Check types for struct keys (see Guidelines - Types)
- Use struct pointers for optional keys (e.g., App.Content)
- Add json directive "omitempty" for optional keys
Guidelines
Naming convention
- UpperCamelCase
- Capitalized abbreviations (e.g., AT, COPPA, PMP etc.)
- Capitalized ID keys
Types
- Key types should be chosen according to OpenRTB specification (attribute types)
- Numeric types:
- architecture-independent, e.g.,
int32instead ofint - signed integral types should be used only when absolutely needed (value may contain negative numbers), unsigned integral types are preferred
- enumerations should be represented with minimal integral types, e.g.,
uint8orint8for enumerations with <= 256 variants - for floating-point attributes only
float64type should be used
- architecture-independent, e.g.,
Documentation
- Godoc: documenting Go code
- Each entity (type or struct key) should be documented
- Comments for entities should be copy-pasted "as-is" from OpenRTB specification
Code organization
- Each RTB type should be kept in its own file, named after type
- File names are in underscore_case, e.g.,
type BidRequestshould be declared inbid_request.go - go fmt your code
Languages
Go
100%