Fix Submission StatusMessage #27
@ -717,6 +717,7 @@ components:
|
|||||||
- SubmissionType
|
- SubmissionType
|
||||||
# - TargetAssetID
|
# - TargetAssetID
|
||||||
- StatusID
|
- StatusID
|
||||||
|
- StatusMessage
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
ID:
|
ID:
|
||||||
@ -757,6 +758,9 @@ components:
|
|||||||
StatusID:
|
StatusID:
|
||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int32
|
||||||
|
StatusMessage:
|
||||||
|
type: string
|
||||||
|
maxLength: 256
|
||||||
SubmissionCreate:
|
SubmissionCreate:
|
||||||
required:
|
required:
|
||||||
- DisplayName
|
- DisplayName
|
||||||
|
@ -1464,9 +1464,13 @@ func (s *Submission) encodeFields(e *jx.Encoder) {
|
|||||||
e.FieldStart("StatusID")
|
e.FieldStart("StatusID")
|
||||||
e.Int32(s.StatusID)
|
e.Int32(s.StatusID)
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
e.FieldStart("StatusMessage")
|
||||||
|
e.Str(s.StatusMessage)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var jsonFieldsNameOfSubmission = [13]string{
|
var jsonFieldsNameOfSubmission = [14]string{
|
||||||
0: "ID",
|
0: "ID",
|
||||||
1: "DisplayName",
|
1: "DisplayName",
|
||||||
2: "Creator",
|
2: "Creator",
|
||||||
@ -1480,6 +1484,7 @@ var jsonFieldsNameOfSubmission = [13]string{
|
|||||||
10: "SubmissionType",
|
10: "SubmissionType",
|
||||||
11: "TargetAssetID",
|
11: "TargetAssetID",
|
||||||
12: "StatusID",
|
12: "StatusID",
|
||||||
|
13: "StatusMessage",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode decodes Submission from json.
|
// Decode decodes Submission from json.
|
||||||
@ -1645,6 +1650,18 @@ func (s *Submission) Decode(d *jx.Decoder) error {
|
|||||||
}(); err != nil {
|
}(); err != nil {
|
||||||
return errors.Wrap(err, "decode field \"StatusID\"")
|
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:
|
default:
|
||||||
return d.Skip()
|
return d.Skip()
|
||||||
}
|
}
|
||||||
@ -1656,7 +1673,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,
|
||||||
0b00010111,
|
0b00110111,
|
||||||
} {
|
} {
|
||||||
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.
|
||||||
|
@ -600,6 +600,7 @@ type Submission struct {
|
|||||||
SubmissionType int32 `json:"SubmissionType"`
|
SubmissionType int32 `json:"SubmissionType"`
|
||||||
TargetAssetID OptInt64 `json:"TargetAssetID"`
|
TargetAssetID OptInt64 `json:"TargetAssetID"`
|
||||||
StatusID int32 `json:"StatusID"`
|
StatusID int32 `json:"StatusID"`
|
||||||
|
StatusMessage string `json:"StatusMessage"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetID returns the value of ID.
|
// GetID returns the value of ID.
|
||||||
@ -667,6 +668,11 @@ func (s *Submission) GetStatusID() int32 {
|
|||||||
return s.StatusID
|
return s.StatusID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetStatusMessage returns the value of StatusMessage.
|
||||||
|
func (s *Submission) GetStatusMessage() string {
|
||||||
|
return s.StatusMessage
|
||||||
|
}
|
||||||
|
|
||||||
// SetID sets the value of ID.
|
// SetID sets the value of ID.
|
||||||
func (s *Submission) SetID(val int64) {
|
func (s *Submission) SetID(val int64) {
|
||||||
s.ID = val
|
s.ID = val
|
||||||
@ -732,6 +738,11 @@ func (s *Submission) SetStatusID(val int32) {
|
|||||||
s.StatusID = val
|
s.StatusID = val
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetStatusMessage sets the value of StatusMessage.
|
||||||
|
func (s *Submission) SetStatusMessage(val string) {
|
||||||
|
s.StatusMessage = val
|
||||||
|
}
|
||||||
|
|
||||||
// Ref: #/components/schemas/SubmissionCreate
|
// Ref: #/components/schemas/SubmissionCreate
|
||||||
type SubmissionCreate struct {
|
type SubmissionCreate struct {
|
||||||
DisplayName string `json:"DisplayName"`
|
DisplayName string `json:"DisplayName"`
|
||||||
|
@ -266,6 +266,25 @@ func (s *Submission) Validate() error {
|
|||||||
Error: err,
|
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 {
|
if len(failures) > 0 {
|
||||||
return &validate.Error{Fields: failures}
|
return &validate.Error{Fields: failures}
|
||||||
}
|
}
|
||||||
|
@ -157,6 +157,7 @@ func (svc *Service) GetSubmission(ctx context.Context, params api.GetSubmissionP
|
|||||||
Completed: submission.Completed,
|
Completed: submission.Completed,
|
||||||
TargetAssetID: api.NewOptInt64(int64(submission.TargetAssetID)),
|
TargetAssetID: api.NewOptInt64(int64(submission.TargetAssetID)),
|
||||||
StatusID: int32(submission.StatusID),
|
StatusID: int32(submission.StatusID),
|
||||||
|
StatusMessage: submission.StatusMessage,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user