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

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