openapi: generate

This commit is contained in:
Quaternions 2024-12-17 20:50:25 -08:00
parent 6545fa703d
commit 1d3e553390
3 changed files with 30 additions and 30 deletions

View File

@ -624,18 +624,18 @@ func (s *Pagination) Encode(e *jx.Encoder) {
// encodeFields encodes fields.
func (s *Pagination) encodeFields(e *jx.Encoder) {
{
e.FieldStart("Page")
e.Int32(s.Page)
e.FieldStart("Number")
e.Int32(s.Number)
}
{
e.FieldStart("Limit")
e.Int32(s.Limit)
e.FieldStart("Size")
e.Int32(s.Size)
}
}
var jsonFieldsNameOfPagination = [2]string{
0: "Page",
1: "Limit",
0: "Number",
1: "Size",
}
// Decode decodes Pagination from json.
@ -647,29 +647,29 @@ func (s *Pagination) Decode(d *jx.Decoder) error {
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
switch string(k) {
case "Page":
case "Number":
requiredBitSet[0] |= 1 << 0
if err := func() error {
v, err := d.Int32()
s.Page = int32(v)
s.Number = int32(v)
if err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"Page\"")
return errors.Wrap(err, "decode field \"Number\"")
}
case "Limit":
case "Size":
requiredBitSet[0] |= 1 << 1
if err := func() error {
v, err := d.Int32()
s.Limit = int32(v)
s.Size = int32(v)
if err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"Limit\"")
return errors.Wrap(err, "decode field \"Size\"")
}
default:
return d.Skip()

View File

@ -398,28 +398,28 @@ func (o OptSubmissionFilter) Or(d SubmissionFilter) SubmissionFilter {
// Ref: #/components/schemas/Pagination
type Pagination struct {
Page int32 `json:"Page"`
Limit int32 `json:"Limit"`
Number int32 `json:"Number"`
Size int32 `json:"Size"`
}
// GetPage returns the value of Page.
func (s *Pagination) GetPage() int32 {
return s.Page
// GetNumber returns the value of Number.
func (s *Pagination) GetNumber() int32 {
return s.Number
}
// GetLimit returns the value of Limit.
func (s *Pagination) GetLimit() int32 {
return s.Limit
// GetSize returns the value of Size.
func (s *Pagination) GetSize() int32 {
return s.Size
}
// SetPage sets the value of Page.
func (s *Pagination) SetPage(val int32) {
s.Page = val
// SetNumber sets the value of Number.
func (s *Pagination) SetNumber(val int32) {
s.Number = val
}
// SetLimit sets the value of Limit.
func (s *Pagination) SetLimit(val int32) {
s.Limit = val
// SetSize sets the value of Size.
func (s *Pagination) SetSize(val int32) {
s.Size = val
}
// Ref: #/components/schemas/Script

View File

@ -106,13 +106,13 @@ func (s *Pagination) Validate() error {
MaxExclusive: false,
MultipleOfSet: false,
MultipleOf: 0,
}).Validate(int64(s.Page)); err != nil {
}).Validate(int64(s.Number)); err != nil {
return errors.Wrap(err, "int")
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "Page",
Name: "Number",
Error: err,
})
}
@ -126,13 +126,13 @@ func (s *Pagination) Validate() error {
MaxExclusive: false,
MultipleOfSet: false,
MultipleOf: 0,
}).Validate(int64(s.Limit)); err != nil {
}).Validate(int64(s.Size)); err != nil {
return errors.Wrap(err, "int")
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "Limit",
Name: "Size",
Error: err,
})
}