diff --git a/api/oas_json_gen.go b/api/oas_json_gen.go index e0d240e..b253448 100644 --- a/api/oas_json_gen.go +++ b/api/oas_json_gen.go @@ -10460,8 +10460,10 @@ func (s *PaymentMethodCardResponseCard) encodeFields(e *jx.Encoder) { } } { - e.FieldStart("access_id") - e.Str(s.AccessID) + if s.AccessID.Set { + e.FieldStart("access_id") + s.AccessID.Encode(e) + } } { if s.Acs.Set { @@ -10492,7 +10494,6 @@ func (s *PaymentMethodCardResponseCard) Decode(d *jx.Decoder) error { if s == nil { return errors.New("invalid: unable to decode PaymentMethodCardResponseCard to nil") } - var requiredBitSet [2]uint8 if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { switch string(k) { @@ -10607,11 +10608,9 @@ func (s *PaymentMethodCardResponseCard) Decode(d *jx.Decoder) error { return errors.Wrap(err, "decode field \"merchant_name\"") } case "access_id": - requiredBitSet[1] |= 1 << 3 if err := func() error { - v, err := d.Str() - s.AccessID = string(v) - if err != nil { + s.AccessID.Reset() + if err := s.AccessID.Decode(d); err != nil { return err } return nil @@ -10635,39 +10634,6 @@ func (s *PaymentMethodCardResponseCard) Decode(d *jx.Decoder) error { }); err != nil { return errors.Wrap(err, "decode PaymentMethodCardResponseCard") } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [2]uint8{ - 0b00000000, - 0b00001000, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfPaymentMethodCardResponseCard) { - name = jsonFieldsNameOfPaymentMethodCardResponseCard[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } return nil } diff --git a/api/oas_schemas_gen.go b/api/oas_schemas_gen.go index 8b480dd..4972a03 100644 --- a/api/oas_schemas_gen.go +++ b/api/oas_schemas_gen.go @@ -8591,7 +8591,7 @@ type PaymentMethodCardResponseCard struct { Tds2Type OptNilPaymentMethodCardResponseCardTds2Type `json:"tds2_type"` Tds2Status OptNilPaymentMethodCardResponseCardTds2Status `json:"tds2_status"` MerchantName OptNilString `json:"merchant_name"` - AccessID string `json:"access_id"` + AccessID OptNilString `json:"access_id"` Acs OptNilString `json:"acs"` } @@ -8651,7 +8651,7 @@ func (s *PaymentMethodCardResponseCard) GetMerchantName() OptNilString { } // GetAccessID returns the value of AccessID. -func (s *PaymentMethodCardResponseCard) GetAccessID() string { +func (s *PaymentMethodCardResponseCard) GetAccessID() OptNilString { return s.AccessID } @@ -8716,7 +8716,7 @@ func (s *PaymentMethodCardResponseCard) SetMerchantName(val OptNilString) { } // SetAccessID sets the value of AccessID. -func (s *PaymentMethodCardResponseCard) SetAccessID(val string) { +func (s *PaymentMethodCardResponseCard) SetAccessID(val OptNilString) { s.AccessID = val }