github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/dry_run_results.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package models
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"strconv"
    10  
    11  	strfmt "github.com/go-openapi/strfmt"
    12  
    13  	"github.com/go-openapi/errors"
    14  	"github.com/go-openapi/swag"
    15  	"github.com/go-openapi/validate"
    16  )
    17  
    18  // DryRunResults dry run results
    19  // swagger:model DryRunResults
    20  type DryRunResults struct {
    21  
    22  	// results
    23  	// Required: true
    24  	Results []*DryRunResult `json:"results"`
    25  }
    26  
    27  // Validate validates this dry run results
    28  func (m *DryRunResults) Validate(formats strfmt.Registry) error {
    29  	var res []error
    30  
    31  	if err := m.validateResults(formats); err != nil {
    32  		res = append(res, err)
    33  	}
    34  
    35  	if len(res) > 0 {
    36  		return errors.CompositeValidationError(res...)
    37  	}
    38  	return nil
    39  }
    40  
    41  func (m *DryRunResults) validateResults(formats strfmt.Registry) error {
    42  
    43  	if err := validate.Required("results", "body", m.Results); err != nil {
    44  		return err
    45  	}
    46  
    47  	for i := 0; i < len(m.Results); i++ {
    48  		if swag.IsZero(m.Results[i]) { // not required
    49  			continue
    50  		}
    51  
    52  		if m.Results[i] != nil {
    53  			if err := m.Results[i].Validate(formats); err != nil {
    54  				if ve, ok := err.(*errors.Validation); ok {
    55  					return ve.ValidateName("results" + "." + strconv.Itoa(i))
    56  				}
    57  				return err
    58  			}
    59  		}
    60  
    61  	}
    62  
    63  	return nil
    64  }
    65  
    66  // MarshalBinary interface implementation
    67  func (m *DryRunResults) MarshalBinary() ([]byte, error) {
    68  	if m == nil {
    69  		return nil, nil
    70  	}
    71  	return swag.WriteJSON(m)
    72  }
    73  
    74  // UnmarshalBinary interface implementation
    75  func (m *DryRunResults) UnmarshalBinary(b []byte) error {
    76  	var res DryRunResults
    77  	if err := swag.ReadJSON(b, &res); err != nil {
    78  		return err
    79  	}
    80  	*m = res
    81  	return nil
    82  }