github.com/weaviate/weaviate@v1.24.6/entities/models/c11y_words_response.go (about)

     1  //                           _       _
     2  // __      _____  __ ___   ___  __ _| |_ ___
     3  // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
     4  //  \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
     5  //   \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
     6  //
     7  //  Copyright © 2016 - 2024 Weaviate B.V. All rights reserved.
     8  //
     9  //  CONTACT: hello@weaviate.io
    10  //
    11  
    12  // Code generated by go-swagger; DO NOT EDIT.
    13  
    14  package models
    15  
    16  // This file was generated by the swagger tool.
    17  // Editing this file might prove futile when you re-run the swagger generate command
    18  
    19  import (
    20  	"context"
    21  	"strconv"
    22  
    23  	"github.com/go-openapi/errors"
    24  	"github.com/go-openapi/strfmt"
    25  	"github.com/go-openapi/swag"
    26  )
    27  
    28  // C11yWordsResponse An array of available words and contexts.
    29  //
    30  // swagger:model C11yWordsResponse
    31  type C11yWordsResponse struct {
    32  
    33  	// concatenated word
    34  	ConcatenatedWord *C11yWordsResponseConcatenatedWord `json:"concatenatedWord,omitempty"`
    35  
    36  	// Weighted results for per individual word
    37  	IndividualWords []*C11yWordsResponseIndividualWordsItems0 `json:"individualWords"`
    38  }
    39  
    40  // Validate validates this c11y words response
    41  func (m *C11yWordsResponse) Validate(formats strfmt.Registry) error {
    42  	var res []error
    43  
    44  	if err := m.validateConcatenatedWord(formats); err != nil {
    45  		res = append(res, err)
    46  	}
    47  
    48  	if err := m.validateIndividualWords(formats); err != nil {
    49  		res = append(res, err)
    50  	}
    51  
    52  	if len(res) > 0 {
    53  		return errors.CompositeValidationError(res...)
    54  	}
    55  	return nil
    56  }
    57  
    58  func (m *C11yWordsResponse) validateConcatenatedWord(formats strfmt.Registry) error {
    59  	if swag.IsZero(m.ConcatenatedWord) { // not required
    60  		return nil
    61  	}
    62  
    63  	if m.ConcatenatedWord != nil {
    64  		if err := m.ConcatenatedWord.Validate(formats); err != nil {
    65  			if ve, ok := err.(*errors.Validation); ok {
    66  				return ve.ValidateName("concatenatedWord")
    67  			} else if ce, ok := err.(*errors.CompositeError); ok {
    68  				return ce.ValidateName("concatenatedWord")
    69  			}
    70  			return err
    71  		}
    72  	}
    73  
    74  	return nil
    75  }
    76  
    77  func (m *C11yWordsResponse) validateIndividualWords(formats strfmt.Registry) error {
    78  	if swag.IsZero(m.IndividualWords) { // not required
    79  		return nil
    80  	}
    81  
    82  	for i := 0; i < len(m.IndividualWords); i++ {
    83  		if swag.IsZero(m.IndividualWords[i]) { // not required
    84  			continue
    85  		}
    86  
    87  		if m.IndividualWords[i] != nil {
    88  			if err := m.IndividualWords[i].Validate(formats); err != nil {
    89  				if ve, ok := err.(*errors.Validation); ok {
    90  					return ve.ValidateName("individualWords" + "." + strconv.Itoa(i))
    91  				} else if ce, ok := err.(*errors.CompositeError); ok {
    92  					return ce.ValidateName("individualWords" + "." + strconv.Itoa(i))
    93  				}
    94  				return err
    95  			}
    96  		}
    97  
    98  	}
    99  
   100  	return nil
   101  }
   102  
   103  // ContextValidate validate this c11y words response based on the context it is used
   104  func (m *C11yWordsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   105  	var res []error
   106  
   107  	if err := m.contextValidateConcatenatedWord(ctx, formats); err != nil {
   108  		res = append(res, err)
   109  	}
   110  
   111  	if err := m.contextValidateIndividualWords(ctx, formats); err != nil {
   112  		res = append(res, err)
   113  	}
   114  
   115  	if len(res) > 0 {
   116  		return errors.CompositeValidationError(res...)
   117  	}
   118  	return nil
   119  }
   120  
   121  func (m *C11yWordsResponse) contextValidateConcatenatedWord(ctx context.Context, formats strfmt.Registry) error {
   122  
   123  	if m.ConcatenatedWord != nil {
   124  		if err := m.ConcatenatedWord.ContextValidate(ctx, formats); err != nil {
   125  			if ve, ok := err.(*errors.Validation); ok {
   126  				return ve.ValidateName("concatenatedWord")
   127  			} else if ce, ok := err.(*errors.CompositeError); ok {
   128  				return ce.ValidateName("concatenatedWord")
   129  			}
   130  			return err
   131  		}
   132  	}
   133  
   134  	return nil
   135  }
   136  
   137  func (m *C11yWordsResponse) contextValidateIndividualWords(ctx context.Context, formats strfmt.Registry) error {
   138  
   139  	for i := 0; i < len(m.IndividualWords); i++ {
   140  
   141  		if m.IndividualWords[i] != nil {
   142  			if err := m.IndividualWords[i].ContextValidate(ctx, formats); err != nil {
   143  				if ve, ok := err.(*errors.Validation); ok {
   144  					return ve.ValidateName("individualWords" + "." + strconv.Itoa(i))
   145  				} else if ce, ok := err.(*errors.CompositeError); ok {
   146  					return ce.ValidateName("individualWords" + "." + strconv.Itoa(i))
   147  				}
   148  				return err
   149  			}
   150  		}
   151  
   152  	}
   153  
   154  	return nil
   155  }
   156  
   157  // MarshalBinary interface implementation
   158  func (m *C11yWordsResponse) MarshalBinary() ([]byte, error) {
   159  	if m == nil {
   160  		return nil, nil
   161  	}
   162  	return swag.WriteJSON(m)
   163  }
   164  
   165  // UnmarshalBinary interface implementation
   166  func (m *C11yWordsResponse) UnmarshalBinary(b []byte) error {
   167  	var res C11yWordsResponse
   168  	if err := swag.ReadJSON(b, &res); err != nil {
   169  		return err
   170  	}
   171  	*m = res
   172  	return nil
   173  }
   174  
   175  // C11yWordsResponseConcatenatedWord Weighted results for all words
   176  //
   177  // swagger:model C11yWordsResponseConcatenatedWord
   178  type C11yWordsResponseConcatenatedWord struct {
   179  
   180  	// concatenated nearest neighbors
   181  	ConcatenatedNearestNeighbors C11yNearestNeighbors `json:"concatenatedNearestNeighbors,omitempty"`
   182  
   183  	// concatenated vector
   184  	ConcatenatedVector C11yVector `json:"concatenatedVector,omitempty"`
   185  
   186  	// concatenated word
   187  	ConcatenatedWord string `json:"concatenatedWord,omitempty"`
   188  
   189  	// single words
   190  	SingleWords []string `json:"singleWords"`
   191  }
   192  
   193  // Validate validates this c11y words response concatenated word
   194  func (m *C11yWordsResponseConcatenatedWord) Validate(formats strfmt.Registry) error {
   195  	var res []error
   196  
   197  	if err := m.validateConcatenatedNearestNeighbors(formats); err != nil {
   198  		res = append(res, err)
   199  	}
   200  
   201  	if err := m.validateConcatenatedVector(formats); err != nil {
   202  		res = append(res, err)
   203  	}
   204  
   205  	if len(res) > 0 {
   206  		return errors.CompositeValidationError(res...)
   207  	}
   208  	return nil
   209  }
   210  
   211  func (m *C11yWordsResponseConcatenatedWord) validateConcatenatedNearestNeighbors(formats strfmt.Registry) error {
   212  	if swag.IsZero(m.ConcatenatedNearestNeighbors) { // not required
   213  		return nil
   214  	}
   215  
   216  	if err := m.ConcatenatedNearestNeighbors.Validate(formats); err != nil {
   217  		if ve, ok := err.(*errors.Validation); ok {
   218  			return ve.ValidateName("concatenatedWord" + "." + "concatenatedNearestNeighbors")
   219  		} else if ce, ok := err.(*errors.CompositeError); ok {
   220  			return ce.ValidateName("concatenatedWord" + "." + "concatenatedNearestNeighbors")
   221  		}
   222  		return err
   223  	}
   224  
   225  	return nil
   226  }
   227  
   228  func (m *C11yWordsResponseConcatenatedWord) validateConcatenatedVector(formats strfmt.Registry) error {
   229  	if swag.IsZero(m.ConcatenatedVector) { // not required
   230  		return nil
   231  	}
   232  
   233  	if err := m.ConcatenatedVector.Validate(formats); err != nil {
   234  		if ve, ok := err.(*errors.Validation); ok {
   235  			return ve.ValidateName("concatenatedWord" + "." + "concatenatedVector")
   236  		} else if ce, ok := err.(*errors.CompositeError); ok {
   237  			return ce.ValidateName("concatenatedWord" + "." + "concatenatedVector")
   238  		}
   239  		return err
   240  	}
   241  
   242  	return nil
   243  }
   244  
   245  // ContextValidate validate this c11y words response concatenated word based on the context it is used
   246  func (m *C11yWordsResponseConcatenatedWord) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   247  	var res []error
   248  
   249  	if err := m.contextValidateConcatenatedNearestNeighbors(ctx, formats); err != nil {
   250  		res = append(res, err)
   251  	}
   252  
   253  	if err := m.contextValidateConcatenatedVector(ctx, formats); err != nil {
   254  		res = append(res, err)
   255  	}
   256  
   257  	if len(res) > 0 {
   258  		return errors.CompositeValidationError(res...)
   259  	}
   260  	return nil
   261  }
   262  
   263  func (m *C11yWordsResponseConcatenatedWord) contextValidateConcatenatedNearestNeighbors(ctx context.Context, formats strfmt.Registry) error {
   264  
   265  	if err := m.ConcatenatedNearestNeighbors.ContextValidate(ctx, formats); err != nil {
   266  		if ve, ok := err.(*errors.Validation); ok {
   267  			return ve.ValidateName("concatenatedWord" + "." + "concatenatedNearestNeighbors")
   268  		} else if ce, ok := err.(*errors.CompositeError); ok {
   269  			return ce.ValidateName("concatenatedWord" + "." + "concatenatedNearestNeighbors")
   270  		}
   271  		return err
   272  	}
   273  
   274  	return nil
   275  }
   276  
   277  func (m *C11yWordsResponseConcatenatedWord) contextValidateConcatenatedVector(ctx context.Context, formats strfmt.Registry) error {
   278  
   279  	if err := m.ConcatenatedVector.ContextValidate(ctx, formats); err != nil {
   280  		if ve, ok := err.(*errors.Validation); ok {
   281  			return ve.ValidateName("concatenatedWord" + "." + "concatenatedVector")
   282  		} else if ce, ok := err.(*errors.CompositeError); ok {
   283  			return ce.ValidateName("concatenatedWord" + "." + "concatenatedVector")
   284  		}
   285  		return err
   286  	}
   287  
   288  	return nil
   289  }
   290  
   291  // MarshalBinary interface implementation
   292  func (m *C11yWordsResponseConcatenatedWord) MarshalBinary() ([]byte, error) {
   293  	if m == nil {
   294  		return nil, nil
   295  	}
   296  	return swag.WriteJSON(m)
   297  }
   298  
   299  // UnmarshalBinary interface implementation
   300  func (m *C11yWordsResponseConcatenatedWord) UnmarshalBinary(b []byte) error {
   301  	var res C11yWordsResponseConcatenatedWord
   302  	if err := swag.ReadJSON(b, &res); err != nil {
   303  		return err
   304  	}
   305  	*m = res
   306  	return nil
   307  }
   308  
   309  // C11yWordsResponseIndividualWordsItems0 c11y words response individual words items0
   310  //
   311  // swagger:model C11yWordsResponseIndividualWordsItems0
   312  type C11yWordsResponseIndividualWordsItems0 struct {
   313  
   314  	// info
   315  	Info *C11yWordsResponseIndividualWordsItems0Info `json:"info,omitempty"`
   316  
   317  	// present
   318  	Present bool `json:"present,omitempty"`
   319  
   320  	// word
   321  	Word string `json:"word,omitempty"`
   322  }
   323  
   324  // Validate validates this c11y words response individual words items0
   325  func (m *C11yWordsResponseIndividualWordsItems0) Validate(formats strfmt.Registry) error {
   326  	var res []error
   327  
   328  	if err := m.validateInfo(formats); err != nil {
   329  		res = append(res, err)
   330  	}
   331  
   332  	if len(res) > 0 {
   333  		return errors.CompositeValidationError(res...)
   334  	}
   335  	return nil
   336  }
   337  
   338  func (m *C11yWordsResponseIndividualWordsItems0) validateInfo(formats strfmt.Registry) error {
   339  	if swag.IsZero(m.Info) { // not required
   340  		return nil
   341  	}
   342  
   343  	if m.Info != nil {
   344  		if err := m.Info.Validate(formats); err != nil {
   345  			if ve, ok := err.(*errors.Validation); ok {
   346  				return ve.ValidateName("info")
   347  			} else if ce, ok := err.(*errors.CompositeError); ok {
   348  				return ce.ValidateName("info")
   349  			}
   350  			return err
   351  		}
   352  	}
   353  
   354  	return nil
   355  }
   356  
   357  // ContextValidate validate this c11y words response individual words items0 based on the context it is used
   358  func (m *C11yWordsResponseIndividualWordsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   359  	var res []error
   360  
   361  	if err := m.contextValidateInfo(ctx, formats); err != nil {
   362  		res = append(res, err)
   363  	}
   364  
   365  	if len(res) > 0 {
   366  		return errors.CompositeValidationError(res...)
   367  	}
   368  	return nil
   369  }
   370  
   371  func (m *C11yWordsResponseIndividualWordsItems0) contextValidateInfo(ctx context.Context, formats strfmt.Registry) error {
   372  
   373  	if m.Info != nil {
   374  		if err := m.Info.ContextValidate(ctx, formats); err != nil {
   375  			if ve, ok := err.(*errors.Validation); ok {
   376  				return ve.ValidateName("info")
   377  			} else if ce, ok := err.(*errors.CompositeError); ok {
   378  				return ce.ValidateName("info")
   379  			}
   380  			return err
   381  		}
   382  	}
   383  
   384  	return nil
   385  }
   386  
   387  // MarshalBinary interface implementation
   388  func (m *C11yWordsResponseIndividualWordsItems0) MarshalBinary() ([]byte, error) {
   389  	if m == nil {
   390  		return nil, nil
   391  	}
   392  	return swag.WriteJSON(m)
   393  }
   394  
   395  // UnmarshalBinary interface implementation
   396  func (m *C11yWordsResponseIndividualWordsItems0) UnmarshalBinary(b []byte) error {
   397  	var res C11yWordsResponseIndividualWordsItems0
   398  	if err := swag.ReadJSON(b, &res); err != nil {
   399  		return err
   400  	}
   401  	*m = res
   402  	return nil
   403  }
   404  
   405  // C11yWordsResponseIndividualWordsItems0Info c11y words response individual words items0 info
   406  //
   407  // swagger:model C11yWordsResponseIndividualWordsItems0Info
   408  type C11yWordsResponseIndividualWordsItems0Info struct {
   409  
   410  	// nearest neighbors
   411  	NearestNeighbors C11yNearestNeighbors `json:"nearestNeighbors,omitempty"`
   412  
   413  	// vector
   414  	Vector C11yVector `json:"vector,omitempty"`
   415  }
   416  
   417  // Validate validates this c11y words response individual words items0 info
   418  func (m *C11yWordsResponseIndividualWordsItems0Info) Validate(formats strfmt.Registry) error {
   419  	var res []error
   420  
   421  	if err := m.validateNearestNeighbors(formats); err != nil {
   422  		res = append(res, err)
   423  	}
   424  
   425  	if err := m.validateVector(formats); err != nil {
   426  		res = append(res, err)
   427  	}
   428  
   429  	if len(res) > 0 {
   430  		return errors.CompositeValidationError(res...)
   431  	}
   432  	return nil
   433  }
   434  
   435  func (m *C11yWordsResponseIndividualWordsItems0Info) validateNearestNeighbors(formats strfmt.Registry) error {
   436  	if swag.IsZero(m.NearestNeighbors) { // not required
   437  		return nil
   438  	}
   439  
   440  	if err := m.NearestNeighbors.Validate(formats); err != nil {
   441  		if ve, ok := err.(*errors.Validation); ok {
   442  			return ve.ValidateName("info" + "." + "nearestNeighbors")
   443  		} else if ce, ok := err.(*errors.CompositeError); ok {
   444  			return ce.ValidateName("info" + "." + "nearestNeighbors")
   445  		}
   446  		return err
   447  	}
   448  
   449  	return nil
   450  }
   451  
   452  func (m *C11yWordsResponseIndividualWordsItems0Info) validateVector(formats strfmt.Registry) error {
   453  	if swag.IsZero(m.Vector) { // not required
   454  		return nil
   455  	}
   456  
   457  	if err := m.Vector.Validate(formats); err != nil {
   458  		if ve, ok := err.(*errors.Validation); ok {
   459  			return ve.ValidateName("info" + "." + "vector")
   460  		} else if ce, ok := err.(*errors.CompositeError); ok {
   461  			return ce.ValidateName("info" + "." + "vector")
   462  		}
   463  		return err
   464  	}
   465  
   466  	return nil
   467  }
   468  
   469  // ContextValidate validate this c11y words response individual words items0 info based on the context it is used
   470  func (m *C11yWordsResponseIndividualWordsItems0Info) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   471  	var res []error
   472  
   473  	if err := m.contextValidateNearestNeighbors(ctx, formats); err != nil {
   474  		res = append(res, err)
   475  	}
   476  
   477  	if err := m.contextValidateVector(ctx, formats); err != nil {
   478  		res = append(res, err)
   479  	}
   480  
   481  	if len(res) > 0 {
   482  		return errors.CompositeValidationError(res...)
   483  	}
   484  	return nil
   485  }
   486  
   487  func (m *C11yWordsResponseIndividualWordsItems0Info) contextValidateNearestNeighbors(ctx context.Context, formats strfmt.Registry) error {
   488  
   489  	if err := m.NearestNeighbors.ContextValidate(ctx, formats); err != nil {
   490  		if ve, ok := err.(*errors.Validation); ok {
   491  			return ve.ValidateName("info" + "." + "nearestNeighbors")
   492  		} else if ce, ok := err.(*errors.CompositeError); ok {
   493  			return ce.ValidateName("info" + "." + "nearestNeighbors")
   494  		}
   495  		return err
   496  	}
   497  
   498  	return nil
   499  }
   500  
   501  func (m *C11yWordsResponseIndividualWordsItems0Info) contextValidateVector(ctx context.Context, formats strfmt.Registry) error {
   502  
   503  	if err := m.Vector.ContextValidate(ctx, formats); err != nil {
   504  		if ve, ok := err.(*errors.Validation); ok {
   505  			return ve.ValidateName("info" + "." + "vector")
   506  		} else if ce, ok := err.(*errors.CompositeError); ok {
   507  			return ce.ValidateName("info" + "." + "vector")
   508  		}
   509  		return err
   510  	}
   511  
   512  	return nil
   513  }
   514  
   515  // MarshalBinary interface implementation
   516  func (m *C11yWordsResponseIndividualWordsItems0Info) MarshalBinary() ([]byte, error) {
   517  	if m == nil {
   518  		return nil, nil
   519  	}
   520  	return swag.WriteJSON(m)
   521  }
   522  
   523  // UnmarshalBinary interface implementation
   524  func (m *C11yWordsResponseIndividualWordsItems0Info) UnmarshalBinary(b []byte) error {
   525  	var res C11yWordsResponseIndividualWordsItems0Info
   526  	if err := swag.ReadJSON(b, &res); err != nil {
   527  		return err
   528  	}
   529  	*m = res
   530  	return nil
   531  }