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
- Hash
- Source
# - SubmissionID
- SubmissionID
type: object
properties:
ID:

View File

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

View File

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