script always has a SubmissionID, it's just 0

This commit is contained in:
Quaternions 2024-12-05 19:24:24 -08:00
parent ee7e5371a8
commit 2dcae799da
3 changed files with 14 additions and 14 deletions

View File

@ -674,7 +674,7 @@ components:
- ID - ID
- Hash - Hash
- Source - Source
# - SubmissionID - SubmissionID
type: object type: object
properties: properties:
ID: ID:

View File

@ -348,10 +348,8 @@ func (s *Script) encodeFields(e *jx.Encoder) {
e.Str(s.Source) e.Str(s.Source)
} }
{ {
if s.SubmissionID.Set {
e.FieldStart("SubmissionID") e.FieldStart("SubmissionID")
s.SubmissionID.Encode(e) e.Int64(s.SubmissionID)
}
} }
} }
@ -408,9 +406,11 @@ func (s *Script) Decode(d *jx.Decoder) error {
return errors.Wrap(err, "decode field \"Source\"") return errors.Wrap(err, "decode field \"Source\"")
} }
case "SubmissionID": case "SubmissionID":
requiredBitSet[0] |= 1 << 3
if err := func() error { if err := func() error {
s.SubmissionID.Reset() v, err := d.Int64()
if err := s.SubmissionID.Decode(d); err != nil { s.SubmissionID = int64(v)
if err != nil {
return err return err
} }
return nil return nil
@ -427,7 +427,7 @@ func (s *Script) Decode(d *jx.Decoder) error {
// Validate required fields. // Validate required fields.
var failures []validate.FieldError var failures []validate.FieldError
for i, mask := range [1]uint8{ for i, mask := range [1]uint8{
0b00000111, 0b00001111,
} { } {
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
// Mask only required fields and check equality to mask using XOR. // Mask only required fields and check equality to mask using XOR.

View File

@ -343,7 +343,7 @@ type Script struct {
ID int64 `json:"ID"` ID int64 `json:"ID"`
Hash string `json:"Hash"` Hash string `json:"Hash"`
Source string `json:"Source"` Source string `json:"Source"`
SubmissionID OptInt64 `json:"SubmissionID"` SubmissionID int64 `json:"SubmissionID"`
} }
// GetID returns the value of ID. // GetID returns the value of ID.
@ -362,7 +362,7 @@ func (s *Script) GetSource() string {
} }
// GetSubmissionID returns the value of SubmissionID. // GetSubmissionID returns the value of SubmissionID.
func (s *Script) GetSubmissionID() OptInt64 { func (s *Script) GetSubmissionID() int64 {
return s.SubmissionID return s.SubmissionID
} }
@ -382,7 +382,7 @@ func (s *Script) SetSource(val string) {
} }
// SetSubmissionID sets the value of SubmissionID. // SetSubmissionID sets the value of SubmissionID.
func (s *Script) SetSubmissionID(val OptInt64) { func (s *Script) SetSubmissionID(val int64) {
s.SubmissionID = val s.SubmissionID = val
} }