bitbucket.org/Aishee/synsec@v0.0.0-20210414005726-236fc01a153d/pkg/models/error_response.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  	"github.com/go-openapi/errors"
    10  	"github.com/go-openapi/strfmt"
    11  	"github.com/go-openapi/swag"
    12  	"github.com/go-openapi/validate"
    13  )
    14  
    15  // ErrorResponse error response
    16  //
    17  // error response return by the API
    18  //
    19  // swagger:model ErrorResponse
    20  type ErrorResponse struct {
    21  
    22  	// more detail on individual errors
    23  	Errors string `json:"errors,omitempty"`
    24  
    25  	// Error message
    26  	// Required: true
    27  	Message *string `json:"message"`
    28  }
    29  
    30  // Validate validates this error response
    31  func (m *ErrorResponse) Validate(formats strfmt.Registry) error {
    32  	var res []error
    33  
    34  	if err := m.validateMessage(formats); err != nil {
    35  		res = append(res, err)
    36  	}
    37  
    38  	if len(res) > 0 {
    39  		return errors.CompositeValidationError(res...)
    40  	}
    41  	return nil
    42  }
    43  
    44  func (m *ErrorResponse) validateMessage(formats strfmt.Registry) error {
    45  
    46  	if err := validate.Required("message", "body", m.Message); err != nil {
    47  		return err
    48  	}
    49  
    50  	return nil
    51  }
    52  
    53  // MarshalBinary interface implementation
    54  func (m *ErrorResponse) MarshalBinary() ([]byte, error) {
    55  	if m == nil {
    56  		return nil, nil
    57  	}
    58  	return swag.WriteJSON(m)
    59  }
    60  
    61  // UnmarshalBinary interface implementation
    62  func (m *ErrorResponse) UnmarshalBinary(b []byte) error {
    63  	var res ErrorResponse
    64  	if err := swag.ReadJSON(b, &res); err != nil {
    65  		return err
    66  	}
    67  	*m = res
    68  	return nil
    69  }