github.com/minio/console@v1.3.0/models/release_info.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  // This file is part of MinIO Console Server
     4  // Copyright (c) 2023 MinIO, Inc.
     5  //
     6  // This program is free software: you can redistribute it and/or modify
     7  // it under the terms of the GNU Affero General Public License as published by
     8  // the Free Software Foundation, either version 3 of the License, or
     9  // (at your option) any later version.
    10  //
    11  // This program is distributed in the hope that it will be useful,
    12  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14  // GNU Affero General Public License for more details.
    15  //
    16  // You should have received a copy of the GNU Affero General Public License
    17  // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    18  //
    19  
    20  package models
    21  
    22  // This file was generated by the swagger tool.
    23  // Editing this file might prove futile when you re-run the swagger generate command
    24  
    25  import (
    26  	"context"
    27  
    28  	"github.com/go-openapi/errors"
    29  	"github.com/go-openapi/strfmt"
    30  	"github.com/go-openapi/swag"
    31  )
    32  
    33  // ReleaseInfo release info
    34  //
    35  // swagger:model releaseInfo
    36  type ReleaseInfo struct {
    37  
    38  	// breaking changes content
    39  	BreakingChangesContent string `json:"breakingChangesContent,omitempty"`
    40  
    41  	// context content
    42  	ContextContent string `json:"contextContent,omitempty"`
    43  
    44  	// metadata
    45  	Metadata *ReleaseMetadata `json:"metadata,omitempty"`
    46  
    47  	// new features content
    48  	NewFeaturesContent string `json:"newFeaturesContent,omitempty"`
    49  
    50  	// notes content
    51  	NotesContent string `json:"notesContent,omitempty"`
    52  
    53  	// security content
    54  	SecurityContent string `json:"securityContent,omitempty"`
    55  }
    56  
    57  // Validate validates this release info
    58  func (m *ReleaseInfo) Validate(formats strfmt.Registry) error {
    59  	var res []error
    60  
    61  	if err := m.validateMetadata(formats); err != nil {
    62  		res = append(res, err)
    63  	}
    64  
    65  	if len(res) > 0 {
    66  		return errors.CompositeValidationError(res...)
    67  	}
    68  	return nil
    69  }
    70  
    71  func (m *ReleaseInfo) validateMetadata(formats strfmt.Registry) error {
    72  	if swag.IsZero(m.Metadata) { // not required
    73  		return nil
    74  	}
    75  
    76  	if m.Metadata != nil {
    77  		if err := m.Metadata.Validate(formats); err != nil {
    78  			if ve, ok := err.(*errors.Validation); ok {
    79  				return ve.ValidateName("metadata")
    80  			} else if ce, ok := err.(*errors.CompositeError); ok {
    81  				return ce.ValidateName("metadata")
    82  			}
    83  			return err
    84  		}
    85  	}
    86  
    87  	return nil
    88  }
    89  
    90  // ContextValidate validate this release info based on the context it is used
    91  func (m *ReleaseInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    92  	var res []error
    93  
    94  	if err := m.contextValidateMetadata(ctx, formats); err != nil {
    95  		res = append(res, err)
    96  	}
    97  
    98  	if len(res) > 0 {
    99  		return errors.CompositeValidationError(res...)
   100  	}
   101  	return nil
   102  }
   103  
   104  func (m *ReleaseInfo) contextValidateMetadata(ctx context.Context, formats strfmt.Registry) error {
   105  
   106  	if m.Metadata != nil {
   107  
   108  		if swag.IsZero(m.Metadata) { // not required
   109  			return nil
   110  		}
   111  
   112  		if err := m.Metadata.ContextValidate(ctx, formats); err != nil {
   113  			if ve, ok := err.(*errors.Validation); ok {
   114  				return ve.ValidateName("metadata")
   115  			} else if ce, ok := err.(*errors.CompositeError); ok {
   116  				return ce.ValidateName("metadata")
   117  			}
   118  			return err
   119  		}
   120  	}
   121  
   122  	return nil
   123  }
   124  
   125  // MarshalBinary interface implementation
   126  func (m *ReleaseInfo) MarshalBinary() ([]byte, error) {
   127  	if m == nil {
   128  		return nil, nil
   129  	}
   130  	return swag.WriteJSON(m)
   131  }
   132  
   133  // UnmarshalBinary interface implementation
   134  func (m *ReleaseInfo) UnmarshalBinary(b []byte) error {
   135  	var res ReleaseInfo
   136  	if err := swag.ReadJSON(b, &res); err != nil {
   137  		return err
   138  	}
   139  	*m = res
   140  	return nil
   141  }