diff --git a/openapi.yaml b/openapi.yaml index e086cfa..573f0d0 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -717,6 +717,7 @@ components: - SubmissionType # - TargetAssetID - StatusID + - StatusMessage type: object properties: ID: @@ -757,6 +758,9 @@ components: StatusID: type: integer format: int32 + StatusMessage: + type: string + maxLength: 256 SubmissionCreate: required: - DisplayName diff --git a/pkg/api/oas_json_gen.go b/pkg/api/oas_json_gen.go index 6f209be..ab1cd86 100644 --- a/pkg/api/oas_json_gen.go +++ b/pkg/api/oas_json_gen.go @@ -1464,9 +1464,13 @@ func (s *Submission) encodeFields(e *jx.Encoder) { e.FieldStart("StatusID") e.Int32(s.StatusID) } + { + e.FieldStart("StatusMessage") + e.Str(s.StatusMessage) + } } -var jsonFieldsNameOfSubmission = [13]string{ +var jsonFieldsNameOfSubmission = [14]string{ 0: "ID", 1: "DisplayName", 2: "Creator", @@ -1480,6 +1484,7 @@ var jsonFieldsNameOfSubmission = [13]string{ 10: "SubmissionType", 11: "TargetAssetID", 12: "StatusID", + 13: "StatusMessage", } // Decode decodes Submission from json. @@ -1645,6 +1650,18 @@ func (s *Submission) Decode(d *jx.Decoder) error { }(); err != nil { return errors.Wrap(err, "decode field \"StatusID\"") } + case "StatusMessage": + requiredBitSet[1] |= 1 << 5 + if err := func() error { + v, err := d.Str() + s.StatusMessage = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"StatusMessage\"") + } default: return d.Skip() } @@ -1656,7 +1673,7 @@ func (s *Submission) Decode(d *jx.Decoder) error { var failures []validate.FieldError for i, mask := range [2]uint8{ 0b11111111, - 0b00010111, + 0b00110111, } { if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { // Mask only required fields and check equality to mask using XOR. diff --git a/pkg/api/oas_schemas_gen.go b/pkg/api/oas_schemas_gen.go index 5523081..6e5c55c 100644 --- a/pkg/api/oas_schemas_gen.go +++ b/pkg/api/oas_schemas_gen.go @@ -600,6 +600,7 @@ type Submission struct { SubmissionType int32 `json:"SubmissionType"` TargetAssetID OptInt64 `json:"TargetAssetID"` StatusID int32 `json:"StatusID"` + StatusMessage string `json:"StatusMessage"` } // GetID returns the value of ID. @@ -667,6 +668,11 @@ func (s *Submission) GetStatusID() int32 { return s.StatusID } +// GetStatusMessage returns the value of StatusMessage. +func (s *Submission) GetStatusMessage() string { + return s.StatusMessage +} + // SetID sets the value of ID. func (s *Submission) SetID(val int64) { s.ID = val @@ -732,6 +738,11 @@ func (s *Submission) SetStatusID(val int32) { s.StatusID = val } +// SetStatusMessage sets the value of StatusMessage. +func (s *Submission) SetStatusMessage(val string) { + s.StatusMessage = val +} + // Ref: #/components/schemas/SubmissionCreate type SubmissionCreate struct { DisplayName string `json:"DisplayName"` diff --git a/pkg/api/oas_validators_gen.go b/pkg/api/oas_validators_gen.go index b8c4978..3b095dc 100644 --- a/pkg/api/oas_validators_gen.go +++ b/pkg/api/oas_validators_gen.go @@ -266,6 +266,25 @@ func (s *Submission) Validate() error { Error: err, }) } + if err := func() error { + if err := (validate.String{ + MinLength: 0, + MinLengthSet: false, + MaxLength: 256, + MaxLengthSet: true, + Email: false, + Hostname: false, + Regex: nil, + }).Validate(string(s.StatusMessage)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "StatusMessage", + Error: err, + }) + } if len(failures) > 0 { return &validate.Error{Fields: failures} } diff --git a/pkg/service/submissions.go b/pkg/service/submissions.go index baa1308..6e3bfb1 100644 --- a/pkg/service/submissions.go +++ b/pkg/service/submissions.go @@ -157,6 +157,7 @@ func (svc *Service) GetSubmission(ctx context.Context, params api.GetSubmissionP Completed: submission.Completed, TargetAssetID: api.NewOptInt64(int64(submission.TargetAssetID)), StatusID: int32(submission.StatusID), + StatusMessage: submission.StatusMessage, }, nil }