openapi: generate

This commit is contained in:
Quaternions 2025-03-31 15:23:22 -07:00
parent 2d2691b551
commit 9740cbe91a
Signed by: Quaternions
GPG Key ID: D0DF5964F79AC131
2 changed files with 39 additions and 95 deletions

@ -1451,13 +1451,9 @@ func (s *Submission) encodeFields(e *jx.Encoder) {
e.Bool(s.Completed) e.Bool(s.Completed)
} }
{ {
e.FieldStart("SubmissionType") if s.UploadedAssetID.Set {
e.Int32(s.SubmissionType) e.FieldStart("UploadedAssetID")
} s.UploadedAssetID.Encode(e)
{
if s.TargetAssetID.Set {
e.FieldStart("TargetAssetID")
s.TargetAssetID.Encode(e)
} }
} }
{ {
@ -1470,7 +1466,7 @@ func (s *Submission) encodeFields(e *jx.Encoder) {
} }
} }
var jsonFieldsNameOfSubmission = [14]string{ var jsonFieldsNameOfSubmission = [13]string{
0: "ID", 0: "ID",
1: "DisplayName", 1: "DisplayName",
2: "Creator", 2: "Creator",
@ -1481,10 +1477,9 @@ var jsonFieldsNameOfSubmission = [14]string{
7: "AssetID", 7: "AssetID",
8: "AssetVersion", 8: "AssetVersion",
9: "Completed", 9: "Completed",
10: "SubmissionType", 10: "UploadedAssetID",
11: "TargetAssetID", 11: "StatusID",
12: "StatusID", 12: "StatusMessage",
13: "StatusMessage",
} }
// Decode decodes Submission from json. // Decode decodes Submission from json.
@ -1616,30 +1611,18 @@ func (s *Submission) Decode(d *jx.Decoder) error {
}(); err != nil { }(); err != nil {
return errors.Wrap(err, "decode field \"Completed\"") return errors.Wrap(err, "decode field \"Completed\"")
} }
case "SubmissionType": case "UploadedAssetID":
requiredBitSet[1] |= 1 << 2
if err := func() error { if err := func() error {
v, err := d.Int32() s.UploadedAssetID.Reset()
s.SubmissionType = int32(v) if err := s.UploadedAssetID.Decode(d); err != nil {
if err != nil {
return err return err
} }
return nil return nil
}(); err != nil { }(); err != nil {
return errors.Wrap(err, "decode field \"SubmissionType\"") return errors.Wrap(err, "decode field \"UploadedAssetID\"")
}
case "TargetAssetID":
if err := func() error {
s.TargetAssetID.Reset()
if err := s.TargetAssetID.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"TargetAssetID\"")
} }
case "StatusID": case "StatusID":
requiredBitSet[1] |= 1 << 4 requiredBitSet[1] |= 1 << 3
if err := func() error { if err := func() error {
v, err := d.Int32() v, err := d.Int32()
s.StatusID = int32(v) s.StatusID = int32(v)
@ -1651,7 +1634,7 @@ func (s *Submission) Decode(d *jx.Decoder) error {
return errors.Wrap(err, "decode field \"StatusID\"") return errors.Wrap(err, "decode field \"StatusID\"")
} }
case "StatusMessage": case "StatusMessage":
requiredBitSet[1] |= 1 << 5 requiredBitSet[1] |= 1 << 4
if err := func() error { if err := func() error {
v, err := d.Str() v, err := d.Str()
s.StatusMessage = string(v) s.StatusMessage = string(v)
@ -1673,7 +1656,7 @@ func (s *Submission) Decode(d *jx.Decoder) error {
var failures []validate.FieldError var failures []validate.FieldError
for i, mask := range [2]uint8{ for i, mask := range [2]uint8{
0b11111111, 0b11111111,
0b00110111, 0b00011011,
} { } {
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.
@ -1748,21 +1731,14 @@ func (s *SubmissionCreate) encodeFields(e *jx.Encoder) {
e.FieldStart("AssetVersion") e.FieldStart("AssetVersion")
e.Int64(s.AssetVersion) e.Int64(s.AssetVersion)
} }
{
if s.TargetAssetID.Set {
e.FieldStart("TargetAssetID")
s.TargetAssetID.Encode(e)
}
}
} }
var jsonFieldsNameOfSubmissionCreate = [6]string{ var jsonFieldsNameOfSubmissionCreate = [5]string{
0: "DisplayName", 0: "DisplayName",
1: "Creator", 1: "Creator",
2: "GameID", 2: "GameID",
3: "AssetID", 3: "AssetID",
4: "AssetVersion", 4: "AssetVersion",
5: "TargetAssetID",
} }
// Decode decodes SubmissionCreate from json. // Decode decodes SubmissionCreate from json.
@ -1834,16 +1810,6 @@ func (s *SubmissionCreate) Decode(d *jx.Decoder) error {
}(); err != nil { }(); err != nil {
return errors.Wrap(err, "decode field \"AssetVersion\"") return errors.Wrap(err, "decode field \"AssetVersion\"")
} }
case "TargetAssetID":
if err := func() error {
s.TargetAssetID.Reset()
if err := s.TargetAssetID.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"TargetAssetID\"")
}
default: default:
return d.Skip() return d.Skip()
} }

@ -590,20 +590,19 @@ type SetSubmissionCompletedNoContent struct{}
// Ref: #/components/schemas/Submission // Ref: #/components/schemas/Submission
type Submission struct { type Submission struct {
ID int64 `json:"ID"` ID int64 `json:"ID"`
DisplayName string `json:"DisplayName"` DisplayName string `json:"DisplayName"`
Creator string `json:"Creator"` Creator string `json:"Creator"`
GameID int32 `json:"GameID"` GameID int32 `json:"GameID"`
CreatedAt int64 `json:"CreatedAt"` CreatedAt int64 `json:"CreatedAt"`
UpdatedAt int64 `json:"UpdatedAt"` UpdatedAt int64 `json:"UpdatedAt"`
Submitter int64 `json:"Submitter"` Submitter int64 `json:"Submitter"`
AssetID int64 `json:"AssetID"` AssetID int64 `json:"AssetID"`
AssetVersion int64 `json:"AssetVersion"` AssetVersion int64 `json:"AssetVersion"`
Completed bool `json:"Completed"` Completed bool `json:"Completed"`
SubmissionType int32 `json:"SubmissionType"` UploadedAssetID OptInt64 `json:"UploadedAssetID"`
TargetAssetID OptInt64 `json:"TargetAssetID"` StatusID int32 `json:"StatusID"`
StatusID int32 `json:"StatusID"` StatusMessage string `json:"StatusMessage"`
StatusMessage string `json:"StatusMessage"`
} }
// GetID returns the value of ID. // GetID returns the value of ID.
@ -656,14 +655,9 @@ func (s *Submission) GetCompleted() bool {
return s.Completed return s.Completed
} }
// GetSubmissionType returns the value of SubmissionType. // GetUploadedAssetID returns the value of UploadedAssetID.
func (s *Submission) GetSubmissionType() int32 { func (s *Submission) GetUploadedAssetID() OptInt64 {
return s.SubmissionType return s.UploadedAssetID
}
// GetTargetAssetID returns the value of TargetAssetID.
func (s *Submission) GetTargetAssetID() OptInt64 {
return s.TargetAssetID
} }
// GetStatusID returns the value of StatusID. // GetStatusID returns the value of StatusID.
@ -726,14 +720,9 @@ func (s *Submission) SetCompleted(val bool) {
s.Completed = val s.Completed = val
} }
// SetSubmissionType sets the value of SubmissionType. // SetUploadedAssetID sets the value of UploadedAssetID.
func (s *Submission) SetSubmissionType(val int32) { func (s *Submission) SetUploadedAssetID(val OptInt64) {
s.SubmissionType = val s.UploadedAssetID = val
}
// SetTargetAssetID sets the value of TargetAssetID.
func (s *Submission) SetTargetAssetID(val OptInt64) {
s.TargetAssetID = val
} }
// SetStatusID sets the value of StatusID. // SetStatusID sets the value of StatusID.
@ -748,12 +737,11 @@ func (s *Submission) SetStatusMessage(val string) {
// Ref: #/components/schemas/SubmissionCreate // Ref: #/components/schemas/SubmissionCreate
type SubmissionCreate struct { type SubmissionCreate struct {
DisplayName string `json:"DisplayName"` DisplayName string `json:"DisplayName"`
Creator string `json:"Creator"` Creator string `json:"Creator"`
GameID int32 `json:"GameID"` GameID int32 `json:"GameID"`
AssetID int64 `json:"AssetID"` AssetID int64 `json:"AssetID"`
AssetVersion int64 `json:"AssetVersion"` AssetVersion int64 `json:"AssetVersion"`
TargetAssetID OptInt64 `json:"TargetAssetID"`
} }
// GetDisplayName returns the value of DisplayName. // GetDisplayName returns the value of DisplayName.
@ -781,11 +769,6 @@ func (s *SubmissionCreate) GetAssetVersion() int64 {
return s.AssetVersion return s.AssetVersion
} }
// GetTargetAssetID returns the value of TargetAssetID.
func (s *SubmissionCreate) GetTargetAssetID() OptInt64 {
return s.TargetAssetID
}
// SetDisplayName sets the value of DisplayName. // SetDisplayName sets the value of DisplayName.
func (s *SubmissionCreate) SetDisplayName(val string) { func (s *SubmissionCreate) SetDisplayName(val string) {
s.DisplayName = val s.DisplayName = val
@ -811,11 +794,6 @@ func (s *SubmissionCreate) SetAssetVersion(val int64) {
s.AssetVersion = val s.AssetVersion = val
} }
// SetTargetAssetID sets the value of TargetAssetID.
func (s *SubmissionCreate) SetTargetAssetID(val OptInt64) {
s.TargetAssetID = val
}
// UpdateScriptNoContent is response for UpdateScript operation. // UpdateScriptNoContent is response for UpdateScript operation.
type UpdateScriptNoContent struct{} type UpdateScriptNoContent struct{}