github.com/weaviate/weaviate@v1.24.6/entities/models/deprecation.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 22 "github.com/go-openapi/errors" 23 "github.com/go-openapi/strfmt" 24 "github.com/go-openapi/swag" 25 "github.com/go-openapi/validate" 26 ) 27 28 // Deprecation deprecation 29 // 30 // swagger:model Deprecation 31 type Deprecation struct { 32 33 // Describes which API is effected, usually one of: REST, GraphQL 34 APIType string `json:"apiType,omitempty"` 35 36 // The id that uniquely identifies this particular deprecations (mostly used internally) 37 ID string `json:"id,omitempty"` 38 39 // The locations within the specified API affected by this deprecation 40 Locations []string `json:"locations"` 41 42 // User-required object to not be affected by the (planned) removal 43 Mitigation string `json:"mitigation,omitempty"` 44 45 // What this deprecation is about 46 Msg string `json:"msg,omitempty"` 47 48 // A best-effort guess of which upcoming version will remove the feature entirely 49 PlannedRemovalVersion string `json:"plannedRemovalVersion,omitempty"` 50 51 // If the feature has already been removed, it was removed in this version 52 RemovedIn *string `json:"removedIn,omitempty"` 53 54 // If the feature has already been removed, it was removed at this timestamp 55 // Format: date-time 56 RemovedTime *strfmt.DateTime `json:"removedTime,omitempty"` 57 58 // The deprecation was introduced in this version 59 // Format: date-time 60 SinceTime strfmt.DateTime `json:"sinceTime,omitempty"` 61 62 // The deprecation was introduced in this version 63 SinceVersion string `json:"sinceVersion,omitempty"` 64 65 // Whether the problematic API functionality is deprecated (planned to be removed) or already removed 66 Status string `json:"status,omitempty"` 67 } 68 69 // Validate validates this deprecation 70 func (m *Deprecation) Validate(formats strfmt.Registry) error { 71 var res []error 72 73 if err := m.validateRemovedTime(formats); err != nil { 74 res = append(res, err) 75 } 76 77 if err := m.validateSinceTime(formats); err != nil { 78 res = append(res, err) 79 } 80 81 if len(res) > 0 { 82 return errors.CompositeValidationError(res...) 83 } 84 return nil 85 } 86 87 func (m *Deprecation) validateRemovedTime(formats strfmt.Registry) error { 88 if swag.IsZero(m.RemovedTime) { // not required 89 return nil 90 } 91 92 if err := validate.FormatOf("removedTime", "body", "date-time", m.RemovedTime.String(), formats); err != nil { 93 return err 94 } 95 96 return nil 97 } 98 99 func (m *Deprecation) validateSinceTime(formats strfmt.Registry) error { 100 if swag.IsZero(m.SinceTime) { // not required 101 return nil 102 } 103 104 if err := validate.FormatOf("sinceTime", "body", "date-time", m.SinceTime.String(), formats); err != nil { 105 return err 106 } 107 108 return nil 109 } 110 111 // ContextValidate validates this deprecation based on context it is used 112 func (m *Deprecation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 113 return nil 114 } 115 116 // MarshalBinary interface implementation 117 func (m *Deprecation) MarshalBinary() ([]byte, error) { 118 if m == nil { 119 return nil, nil 120 } 121 return swag.WriteJSON(m) 122 } 123 124 // UnmarshalBinary interface implementation 125 func (m *Deprecation) UnmarshalBinary(b []byte) error { 126 var res Deprecation 127 if err := swag.ReadJSON(b, &res); err != nil { 128 return err 129 } 130 *m = res 131 return nil 132 }