Best Keploy code snippet using generated.Schema
zz_generated.conversion.go
Source:zz_generated.conversion.go
...35 return Convert_flowcontrol_FlowDistinguisherMethod_To_v1alpha1_FlowDistinguisherMethod(a.(*flowcontrol.FlowDistinguisherMethod), b.(*v1alpha1.FlowDistinguisherMethod), scope)36 }); err != nil {37 return err38 }39 if err := s.AddGeneratedConversionFunc((*v1alpha1.FlowSchema)(nil), (*flowcontrol.FlowSchema)(nil), func(a, b interface{}, scope conversion.Scope) error {40 return Convert_v1alpha1_FlowSchema_To_flowcontrol_FlowSchema(a.(*v1alpha1.FlowSchema), b.(*flowcontrol.FlowSchema), scope)41 }); err != nil {42 return err43 }44 if err := s.AddGeneratedConversionFunc((*flowcontrol.FlowSchema)(nil), (*v1alpha1.FlowSchema)(nil), func(a, b interface{}, scope conversion.Scope) error {45 return Convert_flowcontrol_FlowSchema_To_v1alpha1_FlowSchema(a.(*flowcontrol.FlowSchema), b.(*v1alpha1.FlowSchema), scope)46 }); err != nil {47 return err48 }49 if err := s.AddGeneratedConversionFunc((*v1alpha1.FlowSchemaCondition)(nil), (*flowcontrol.FlowSchemaCondition)(nil), func(a, b interface{}, scope conversion.Scope) error {50 return Convert_v1alpha1_FlowSchemaCondition_To_flowcontrol_FlowSchemaCondition(a.(*v1alpha1.FlowSchemaCondition), b.(*flowcontrol.FlowSchemaCondition), scope)51 }); err != nil {52 return err53 }54 if err := s.AddGeneratedConversionFunc((*flowcontrol.FlowSchemaCondition)(nil), (*v1alpha1.FlowSchemaCondition)(nil), func(a, b interface{}, scope conversion.Scope) error {55 return Convert_flowcontrol_FlowSchemaCondition_To_v1alpha1_FlowSchemaCondition(a.(*flowcontrol.FlowSchemaCondition), b.(*v1alpha1.FlowSchemaCondition), scope)56 }); err != nil {57 return err58 }59 if err := s.AddGeneratedConversionFunc((*v1alpha1.FlowSchemaList)(nil), (*flowcontrol.FlowSchemaList)(nil), func(a, b interface{}, scope conversion.Scope) error {60 return Convert_v1alpha1_FlowSchemaList_To_flowcontrol_FlowSchemaList(a.(*v1alpha1.FlowSchemaList), b.(*flowcontrol.FlowSchemaList), scope)61 }); err != nil {62 return err63 }64 if err := s.AddGeneratedConversionFunc((*flowcontrol.FlowSchemaList)(nil), (*v1alpha1.FlowSchemaList)(nil), func(a, b interface{}, scope conversion.Scope) error {65 return Convert_flowcontrol_FlowSchemaList_To_v1alpha1_FlowSchemaList(a.(*flowcontrol.FlowSchemaList), b.(*v1alpha1.FlowSchemaList), scope)66 }); err != nil {67 return err68 }69 if err := s.AddGeneratedConversionFunc((*v1alpha1.FlowSchemaSpec)(nil), (*flowcontrol.FlowSchemaSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {70 return Convert_v1alpha1_FlowSchemaSpec_To_flowcontrol_FlowSchemaSpec(a.(*v1alpha1.FlowSchemaSpec), b.(*flowcontrol.FlowSchemaSpec), scope)71 }); err != nil {72 return err73 }74 if err := s.AddGeneratedConversionFunc((*flowcontrol.FlowSchemaSpec)(nil), (*v1alpha1.FlowSchemaSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {75 return Convert_flowcontrol_FlowSchemaSpec_To_v1alpha1_FlowSchemaSpec(a.(*flowcontrol.FlowSchemaSpec), b.(*v1alpha1.FlowSchemaSpec), scope)76 }); err != nil {77 return err78 }79 if err := s.AddGeneratedConversionFunc((*v1alpha1.FlowSchemaStatus)(nil), (*flowcontrol.FlowSchemaStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {80 return Convert_v1alpha1_FlowSchemaStatus_To_flowcontrol_FlowSchemaStatus(a.(*v1alpha1.FlowSchemaStatus), b.(*flowcontrol.FlowSchemaStatus), scope)81 }); err != nil {82 return err83 }84 if err := s.AddGeneratedConversionFunc((*flowcontrol.FlowSchemaStatus)(nil), (*v1alpha1.FlowSchemaStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {85 return Convert_flowcontrol_FlowSchemaStatus_To_v1alpha1_FlowSchemaStatus(a.(*flowcontrol.FlowSchemaStatus), b.(*v1alpha1.FlowSchemaStatus), scope)86 }); err != nil {87 return err88 }89 if err := s.AddGeneratedConversionFunc((*v1alpha1.GroupSubject)(nil), (*flowcontrol.GroupSubject)(nil), func(a, b interface{}, scope conversion.Scope) error {90 return Convert_v1alpha1_GroupSubject_To_flowcontrol_GroupSubject(a.(*v1alpha1.GroupSubject), b.(*flowcontrol.GroupSubject), scope)91 }); err != nil {92 return err93 }94 if err := s.AddGeneratedConversionFunc((*flowcontrol.GroupSubject)(nil), (*v1alpha1.GroupSubject)(nil), func(a, b interface{}, scope conversion.Scope) error {95 return Convert_flowcontrol_GroupSubject_To_v1alpha1_GroupSubject(a.(*flowcontrol.GroupSubject), b.(*v1alpha1.GroupSubject), scope)96 }); err != nil {97 return err98 }99 if err := s.AddGeneratedConversionFunc((*v1alpha1.LimitResponse)(nil), (*flowcontrol.LimitResponse)(nil), func(a, b interface{}, scope conversion.Scope) error {100 return Convert_v1alpha1_LimitResponse_To_flowcontrol_LimitResponse(a.(*v1alpha1.LimitResponse), b.(*flowcontrol.LimitResponse), scope)101 }); err != nil {102 return err103 }104 if err := s.AddGeneratedConversionFunc((*flowcontrol.LimitResponse)(nil), (*v1alpha1.LimitResponse)(nil), func(a, b interface{}, scope conversion.Scope) error {105 return Convert_flowcontrol_LimitResponse_To_v1alpha1_LimitResponse(a.(*flowcontrol.LimitResponse), b.(*v1alpha1.LimitResponse), scope)106 }); err != nil {107 return err108 }109 if err := s.AddGeneratedConversionFunc((*v1alpha1.LimitedPriorityLevelConfiguration)(nil), (*flowcontrol.LimitedPriorityLevelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {110 return Convert_v1alpha1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(a.(*v1alpha1.LimitedPriorityLevelConfiguration), b.(*flowcontrol.LimitedPriorityLevelConfiguration), scope)111 }); err != nil {112 return err113 }114 if err := s.AddGeneratedConversionFunc((*flowcontrol.LimitedPriorityLevelConfiguration)(nil), (*v1alpha1.LimitedPriorityLevelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {115 return Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1alpha1_LimitedPriorityLevelConfiguration(a.(*flowcontrol.LimitedPriorityLevelConfiguration), b.(*v1alpha1.LimitedPriorityLevelConfiguration), scope)116 }); err != nil {117 return err118 }119 if err := s.AddGeneratedConversionFunc((*v1alpha1.NonResourcePolicyRule)(nil), (*flowcontrol.NonResourcePolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error {120 return Convert_v1alpha1_NonResourcePolicyRule_To_flowcontrol_NonResourcePolicyRule(a.(*v1alpha1.NonResourcePolicyRule), b.(*flowcontrol.NonResourcePolicyRule), scope)121 }); err != nil {122 return err123 }124 if err := s.AddGeneratedConversionFunc((*flowcontrol.NonResourcePolicyRule)(nil), (*v1alpha1.NonResourcePolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error {125 return Convert_flowcontrol_NonResourcePolicyRule_To_v1alpha1_NonResourcePolicyRule(a.(*flowcontrol.NonResourcePolicyRule), b.(*v1alpha1.NonResourcePolicyRule), scope)126 }); err != nil {127 return err128 }129 if err := s.AddGeneratedConversionFunc((*v1alpha1.PolicyRulesWithSubjects)(nil), (*flowcontrol.PolicyRulesWithSubjects)(nil), func(a, b interface{}, scope conversion.Scope) error {130 return Convert_v1alpha1_PolicyRulesWithSubjects_To_flowcontrol_PolicyRulesWithSubjects(a.(*v1alpha1.PolicyRulesWithSubjects), b.(*flowcontrol.PolicyRulesWithSubjects), scope)131 }); err != nil {132 return err133 }134 if err := s.AddGeneratedConversionFunc((*flowcontrol.PolicyRulesWithSubjects)(nil), (*v1alpha1.PolicyRulesWithSubjects)(nil), func(a, b interface{}, scope conversion.Scope) error {135 return Convert_flowcontrol_PolicyRulesWithSubjects_To_v1alpha1_PolicyRulesWithSubjects(a.(*flowcontrol.PolicyRulesWithSubjects), b.(*v1alpha1.PolicyRulesWithSubjects), scope)136 }); err != nil {137 return err138 }139 if err := s.AddGeneratedConversionFunc((*v1alpha1.PriorityLevelConfiguration)(nil), (*flowcontrol.PriorityLevelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {140 return Convert_v1alpha1_PriorityLevelConfiguration_To_flowcontrol_PriorityLevelConfiguration(a.(*v1alpha1.PriorityLevelConfiguration), b.(*flowcontrol.PriorityLevelConfiguration), scope)141 }); err != nil {142 return err143 }144 if err := s.AddGeneratedConversionFunc((*flowcontrol.PriorityLevelConfiguration)(nil), (*v1alpha1.PriorityLevelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {145 return Convert_flowcontrol_PriorityLevelConfiguration_To_v1alpha1_PriorityLevelConfiguration(a.(*flowcontrol.PriorityLevelConfiguration), b.(*v1alpha1.PriorityLevelConfiguration), scope)146 }); err != nil {147 return err148 }149 if err := s.AddGeneratedConversionFunc((*v1alpha1.PriorityLevelConfigurationCondition)(nil), (*flowcontrol.PriorityLevelConfigurationCondition)(nil), func(a, b interface{}, scope conversion.Scope) error {150 return Convert_v1alpha1_PriorityLevelConfigurationCondition_To_flowcontrol_PriorityLevelConfigurationCondition(a.(*v1alpha1.PriorityLevelConfigurationCondition), b.(*flowcontrol.PriorityLevelConfigurationCondition), scope)151 }); err != nil {152 return err153 }154 if err := s.AddGeneratedConversionFunc((*flowcontrol.PriorityLevelConfigurationCondition)(nil), (*v1alpha1.PriorityLevelConfigurationCondition)(nil), func(a, b interface{}, scope conversion.Scope) error {155 return Convert_flowcontrol_PriorityLevelConfigurationCondition_To_v1alpha1_PriorityLevelConfigurationCondition(a.(*flowcontrol.PriorityLevelConfigurationCondition), b.(*v1alpha1.PriorityLevelConfigurationCondition), scope)156 }); err != nil {157 return err158 }159 if err := s.AddGeneratedConversionFunc((*v1alpha1.PriorityLevelConfigurationList)(nil), (*flowcontrol.PriorityLevelConfigurationList)(nil), func(a, b interface{}, scope conversion.Scope) error {160 return Convert_v1alpha1_PriorityLevelConfigurationList_To_flowcontrol_PriorityLevelConfigurationList(a.(*v1alpha1.PriorityLevelConfigurationList), b.(*flowcontrol.PriorityLevelConfigurationList), scope)161 }); err != nil {162 return err163 }164 if err := s.AddGeneratedConversionFunc((*flowcontrol.PriorityLevelConfigurationList)(nil), (*v1alpha1.PriorityLevelConfigurationList)(nil), func(a, b interface{}, scope conversion.Scope) error {165 return Convert_flowcontrol_PriorityLevelConfigurationList_To_v1alpha1_PriorityLevelConfigurationList(a.(*flowcontrol.PriorityLevelConfigurationList), b.(*v1alpha1.PriorityLevelConfigurationList), scope)166 }); err != nil {167 return err168 }169 if err := s.AddGeneratedConversionFunc((*v1alpha1.PriorityLevelConfigurationReference)(nil), (*flowcontrol.PriorityLevelConfigurationReference)(nil), func(a, b interface{}, scope conversion.Scope) error {170 return Convert_v1alpha1_PriorityLevelConfigurationReference_To_flowcontrol_PriorityLevelConfigurationReference(a.(*v1alpha1.PriorityLevelConfigurationReference), b.(*flowcontrol.PriorityLevelConfigurationReference), scope)171 }); err != nil {172 return err173 }174 if err := s.AddGeneratedConversionFunc((*flowcontrol.PriorityLevelConfigurationReference)(nil), (*v1alpha1.PriorityLevelConfigurationReference)(nil), func(a, b interface{}, scope conversion.Scope) error {175 return Convert_flowcontrol_PriorityLevelConfigurationReference_To_v1alpha1_PriorityLevelConfigurationReference(a.(*flowcontrol.PriorityLevelConfigurationReference), b.(*v1alpha1.PriorityLevelConfigurationReference), scope)176 }); err != nil {177 return err178 }179 if err := s.AddGeneratedConversionFunc((*v1alpha1.PriorityLevelConfigurationSpec)(nil), (*flowcontrol.PriorityLevelConfigurationSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {180 return Convert_v1alpha1_PriorityLevelConfigurationSpec_To_flowcontrol_PriorityLevelConfigurationSpec(a.(*v1alpha1.PriorityLevelConfigurationSpec), b.(*flowcontrol.PriorityLevelConfigurationSpec), scope)181 }); err != nil {182 return err183 }184 if err := s.AddGeneratedConversionFunc((*flowcontrol.PriorityLevelConfigurationSpec)(nil), (*v1alpha1.PriorityLevelConfigurationSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {185 return Convert_flowcontrol_PriorityLevelConfigurationSpec_To_v1alpha1_PriorityLevelConfigurationSpec(a.(*flowcontrol.PriorityLevelConfigurationSpec), b.(*v1alpha1.PriorityLevelConfigurationSpec), scope)186 }); err != nil {187 return err188 }189 if err := s.AddGeneratedConversionFunc((*v1alpha1.PriorityLevelConfigurationStatus)(nil), (*flowcontrol.PriorityLevelConfigurationStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {190 return Convert_v1alpha1_PriorityLevelConfigurationStatus_To_flowcontrol_PriorityLevelConfigurationStatus(a.(*v1alpha1.PriorityLevelConfigurationStatus), b.(*flowcontrol.PriorityLevelConfigurationStatus), scope)191 }); err != nil {192 return err193 }194 if err := s.AddGeneratedConversionFunc((*flowcontrol.PriorityLevelConfigurationStatus)(nil), (*v1alpha1.PriorityLevelConfigurationStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {195 return Convert_flowcontrol_PriorityLevelConfigurationStatus_To_v1alpha1_PriorityLevelConfigurationStatus(a.(*flowcontrol.PriorityLevelConfigurationStatus), b.(*v1alpha1.PriorityLevelConfigurationStatus), scope)196 }); err != nil {197 return err198 }199 if err := s.AddGeneratedConversionFunc((*v1alpha1.QueuingConfiguration)(nil), (*flowcontrol.QueuingConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {200 return Convert_v1alpha1_QueuingConfiguration_To_flowcontrol_QueuingConfiguration(a.(*v1alpha1.QueuingConfiguration), b.(*flowcontrol.QueuingConfiguration), scope)201 }); err != nil {202 return err203 }204 if err := s.AddGeneratedConversionFunc((*flowcontrol.QueuingConfiguration)(nil), (*v1alpha1.QueuingConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {205 return Convert_flowcontrol_QueuingConfiguration_To_v1alpha1_QueuingConfiguration(a.(*flowcontrol.QueuingConfiguration), b.(*v1alpha1.QueuingConfiguration), scope)206 }); err != nil {207 return err208 }209 if err := s.AddGeneratedConversionFunc((*v1alpha1.ResourcePolicyRule)(nil), (*flowcontrol.ResourcePolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error {210 return Convert_v1alpha1_ResourcePolicyRule_To_flowcontrol_ResourcePolicyRule(a.(*v1alpha1.ResourcePolicyRule), b.(*flowcontrol.ResourcePolicyRule), scope)211 }); err != nil {212 return err213 }214 if err := s.AddGeneratedConversionFunc((*flowcontrol.ResourcePolicyRule)(nil), (*v1alpha1.ResourcePolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error {215 return Convert_flowcontrol_ResourcePolicyRule_To_v1alpha1_ResourcePolicyRule(a.(*flowcontrol.ResourcePolicyRule), b.(*v1alpha1.ResourcePolicyRule), scope)216 }); err != nil {217 return err218 }219 if err := s.AddGeneratedConversionFunc((*v1alpha1.ServiceAccountSubject)(nil), (*flowcontrol.ServiceAccountSubject)(nil), func(a, b interface{}, scope conversion.Scope) error {220 return Convert_v1alpha1_ServiceAccountSubject_To_flowcontrol_ServiceAccountSubject(a.(*v1alpha1.ServiceAccountSubject), b.(*flowcontrol.ServiceAccountSubject), scope)221 }); err != nil {222 return err223 }224 if err := s.AddGeneratedConversionFunc((*flowcontrol.ServiceAccountSubject)(nil), (*v1alpha1.ServiceAccountSubject)(nil), func(a, b interface{}, scope conversion.Scope) error {225 return Convert_flowcontrol_ServiceAccountSubject_To_v1alpha1_ServiceAccountSubject(a.(*flowcontrol.ServiceAccountSubject), b.(*v1alpha1.ServiceAccountSubject), scope)226 }); err != nil {227 return err228 }229 if err := s.AddGeneratedConversionFunc((*v1alpha1.Subject)(nil), (*flowcontrol.Subject)(nil), func(a, b interface{}, scope conversion.Scope) error {230 return Convert_v1alpha1_Subject_To_flowcontrol_Subject(a.(*v1alpha1.Subject), b.(*flowcontrol.Subject), scope)231 }); err != nil {232 return err233 }234 if err := s.AddGeneratedConversionFunc((*flowcontrol.Subject)(nil), (*v1alpha1.Subject)(nil), func(a, b interface{}, scope conversion.Scope) error {235 return Convert_flowcontrol_Subject_To_v1alpha1_Subject(a.(*flowcontrol.Subject), b.(*v1alpha1.Subject), scope)236 }); err != nil {237 return err238 }239 if err := s.AddGeneratedConversionFunc((*v1alpha1.UserSubject)(nil), (*flowcontrol.UserSubject)(nil), func(a, b interface{}, scope conversion.Scope) error {240 return Convert_v1alpha1_UserSubject_To_flowcontrol_UserSubject(a.(*v1alpha1.UserSubject), b.(*flowcontrol.UserSubject), scope)241 }); err != nil {242 return err243 }244 if err := s.AddGeneratedConversionFunc((*flowcontrol.UserSubject)(nil), (*v1alpha1.UserSubject)(nil), func(a, b interface{}, scope conversion.Scope) error {245 return Convert_flowcontrol_UserSubject_To_v1alpha1_UserSubject(a.(*flowcontrol.UserSubject), b.(*v1alpha1.UserSubject), scope)246 }); err != nil {247 return err248 }249 return nil250}251func autoConvert_v1alpha1_FlowDistinguisherMethod_To_flowcontrol_FlowDistinguisherMethod(in *v1alpha1.FlowDistinguisherMethod, out *flowcontrol.FlowDistinguisherMethod, s conversion.Scope) error {252 out.Type = flowcontrol.FlowDistinguisherMethodType(in.Type)253 return nil254}255// Convert_v1alpha1_FlowDistinguisherMethod_To_flowcontrol_FlowDistinguisherMethod is an autogenerated conversion function.256func Convert_v1alpha1_FlowDistinguisherMethod_To_flowcontrol_FlowDistinguisherMethod(in *v1alpha1.FlowDistinguisherMethod, out *flowcontrol.FlowDistinguisherMethod, s conversion.Scope) error {257 return autoConvert_v1alpha1_FlowDistinguisherMethod_To_flowcontrol_FlowDistinguisherMethod(in, out, s)258}259func autoConvert_flowcontrol_FlowDistinguisherMethod_To_v1alpha1_FlowDistinguisherMethod(in *flowcontrol.FlowDistinguisherMethod, out *v1alpha1.FlowDistinguisherMethod, s conversion.Scope) error {260 out.Type = v1alpha1.FlowDistinguisherMethodType(in.Type)261 return nil262}263// Convert_flowcontrol_FlowDistinguisherMethod_To_v1alpha1_FlowDistinguisherMethod is an autogenerated conversion function.264func Convert_flowcontrol_FlowDistinguisherMethod_To_v1alpha1_FlowDistinguisherMethod(in *flowcontrol.FlowDistinguisherMethod, out *v1alpha1.FlowDistinguisherMethod, s conversion.Scope) error {265 return autoConvert_flowcontrol_FlowDistinguisherMethod_To_v1alpha1_FlowDistinguisherMethod(in, out, s)266}267func autoConvert_v1alpha1_FlowSchema_To_flowcontrol_FlowSchema(in *v1alpha1.FlowSchema, out *flowcontrol.FlowSchema, s conversion.Scope) error {268 out.ObjectMeta = in.ObjectMeta269 if err := Convert_v1alpha1_FlowSchemaSpec_To_flowcontrol_FlowSchemaSpec(&in.Spec, &out.Spec, s); err != nil {270 return err271 }272 if err := Convert_v1alpha1_FlowSchemaStatus_To_flowcontrol_FlowSchemaStatus(&in.Status, &out.Status, s); err != nil {273 return err274 }275 return nil276}277// Convert_v1alpha1_FlowSchema_To_flowcontrol_FlowSchema is an autogenerated conversion function.278func Convert_v1alpha1_FlowSchema_To_flowcontrol_FlowSchema(in *v1alpha1.FlowSchema, out *flowcontrol.FlowSchema, s conversion.Scope) error {279 return autoConvert_v1alpha1_FlowSchema_To_flowcontrol_FlowSchema(in, out, s)280}281func autoConvert_flowcontrol_FlowSchema_To_v1alpha1_FlowSchema(in *flowcontrol.FlowSchema, out *v1alpha1.FlowSchema, s conversion.Scope) error {282 out.ObjectMeta = in.ObjectMeta283 if err := Convert_flowcontrol_FlowSchemaSpec_To_v1alpha1_FlowSchemaSpec(&in.Spec, &out.Spec, s); err != nil {284 return err285 }286 if err := Convert_flowcontrol_FlowSchemaStatus_To_v1alpha1_FlowSchemaStatus(&in.Status, &out.Status, s); err != nil {287 return err288 }289 return nil290}291// Convert_flowcontrol_FlowSchema_To_v1alpha1_FlowSchema is an autogenerated conversion function.292func Convert_flowcontrol_FlowSchema_To_v1alpha1_FlowSchema(in *flowcontrol.FlowSchema, out *v1alpha1.FlowSchema, s conversion.Scope) error {293 return autoConvert_flowcontrol_FlowSchema_To_v1alpha1_FlowSchema(in, out, s)294}295func autoConvert_v1alpha1_FlowSchemaCondition_To_flowcontrol_FlowSchemaCondition(in *v1alpha1.FlowSchemaCondition, out *flowcontrol.FlowSchemaCondition, s conversion.Scope) error {296 out.Type = flowcontrol.FlowSchemaConditionType(in.Type)297 out.Status = flowcontrol.ConditionStatus(in.Status)298 out.LastTransitionTime = in.LastTransitionTime299 out.Reason = in.Reason300 out.Message = in.Message301 return nil302}303// Convert_v1alpha1_FlowSchemaCondition_To_flowcontrol_FlowSchemaCondition is an autogenerated conversion function.304func Convert_v1alpha1_FlowSchemaCondition_To_flowcontrol_FlowSchemaCondition(in *v1alpha1.FlowSchemaCondition, out *flowcontrol.FlowSchemaCondition, s conversion.Scope) error {305 return autoConvert_v1alpha1_FlowSchemaCondition_To_flowcontrol_FlowSchemaCondition(in, out, s)306}307func autoConvert_flowcontrol_FlowSchemaCondition_To_v1alpha1_FlowSchemaCondition(in *flowcontrol.FlowSchemaCondition, out *v1alpha1.FlowSchemaCondition, s conversion.Scope) error {308 out.Type = v1alpha1.FlowSchemaConditionType(in.Type)309 out.Status = v1alpha1.ConditionStatus(in.Status)310 out.LastTransitionTime = in.LastTransitionTime311 out.Reason = in.Reason312 out.Message = in.Message313 return nil314}315// Convert_flowcontrol_FlowSchemaCondition_To_v1alpha1_FlowSchemaCondition is an autogenerated conversion function.316func Convert_flowcontrol_FlowSchemaCondition_To_v1alpha1_FlowSchemaCondition(in *flowcontrol.FlowSchemaCondition, out *v1alpha1.FlowSchemaCondition, s conversion.Scope) error {317 return autoConvert_flowcontrol_FlowSchemaCondition_To_v1alpha1_FlowSchemaCondition(in, out, s)318}319func autoConvert_v1alpha1_FlowSchemaList_To_flowcontrol_FlowSchemaList(in *v1alpha1.FlowSchemaList, out *flowcontrol.FlowSchemaList, s conversion.Scope) error {320 out.ListMeta = in.ListMeta321 out.Items = *(*[]flowcontrol.FlowSchema)(unsafe.Pointer(&in.Items))322 return nil323}324// Convert_v1alpha1_FlowSchemaList_To_flowcontrol_FlowSchemaList is an autogenerated conversion function.325func Convert_v1alpha1_FlowSchemaList_To_flowcontrol_FlowSchemaList(in *v1alpha1.FlowSchemaList, out *flowcontrol.FlowSchemaList, s conversion.Scope) error {326 return autoConvert_v1alpha1_FlowSchemaList_To_flowcontrol_FlowSchemaList(in, out, s)327}328func autoConvert_flowcontrol_FlowSchemaList_To_v1alpha1_FlowSchemaList(in *flowcontrol.FlowSchemaList, out *v1alpha1.FlowSchemaList, s conversion.Scope) error {329 out.ListMeta = in.ListMeta330 out.Items = *(*[]v1alpha1.FlowSchema)(unsafe.Pointer(&in.Items))331 return nil332}333// Convert_flowcontrol_FlowSchemaList_To_v1alpha1_FlowSchemaList is an autogenerated conversion function.334func Convert_flowcontrol_FlowSchemaList_To_v1alpha1_FlowSchemaList(in *flowcontrol.FlowSchemaList, out *v1alpha1.FlowSchemaList, s conversion.Scope) error {335 return autoConvert_flowcontrol_FlowSchemaList_To_v1alpha1_FlowSchemaList(in, out, s)336}337func autoConvert_v1alpha1_FlowSchemaSpec_To_flowcontrol_FlowSchemaSpec(in *v1alpha1.FlowSchemaSpec, out *flowcontrol.FlowSchemaSpec, s conversion.Scope) error {338 if err := Convert_v1alpha1_PriorityLevelConfigurationReference_To_flowcontrol_PriorityLevelConfigurationReference(&in.PriorityLevelConfiguration, &out.PriorityLevelConfiguration, s); err != nil {339 return err340 }341 out.MatchingPrecedence = in.MatchingPrecedence342 out.DistinguisherMethod = (*flowcontrol.FlowDistinguisherMethod)(unsafe.Pointer(in.DistinguisherMethod))343 out.Rules = *(*[]flowcontrol.PolicyRulesWithSubjects)(unsafe.Pointer(&in.Rules))344 return nil345}346// Convert_v1alpha1_FlowSchemaSpec_To_flowcontrol_FlowSchemaSpec is an autogenerated conversion function.347func Convert_v1alpha1_FlowSchemaSpec_To_flowcontrol_FlowSchemaSpec(in *v1alpha1.FlowSchemaSpec, out *flowcontrol.FlowSchemaSpec, s conversion.Scope) error {348 return autoConvert_v1alpha1_FlowSchemaSpec_To_flowcontrol_FlowSchemaSpec(in, out, s)349}350func autoConvert_flowcontrol_FlowSchemaSpec_To_v1alpha1_FlowSchemaSpec(in *flowcontrol.FlowSchemaSpec, out *v1alpha1.FlowSchemaSpec, s conversion.Scope) error {351 if err := Convert_flowcontrol_PriorityLevelConfigurationReference_To_v1alpha1_PriorityLevelConfigurationReference(&in.PriorityLevelConfiguration, &out.PriorityLevelConfiguration, s); err != nil {352 return err353 }354 out.MatchingPrecedence = in.MatchingPrecedence355 out.DistinguisherMethod = (*v1alpha1.FlowDistinguisherMethod)(unsafe.Pointer(in.DistinguisherMethod))356 out.Rules = *(*[]v1alpha1.PolicyRulesWithSubjects)(unsafe.Pointer(&in.Rules))357 return nil358}359// Convert_flowcontrol_FlowSchemaSpec_To_v1alpha1_FlowSchemaSpec is an autogenerated conversion function.360func Convert_flowcontrol_FlowSchemaSpec_To_v1alpha1_FlowSchemaSpec(in *flowcontrol.FlowSchemaSpec, out *v1alpha1.FlowSchemaSpec, s conversion.Scope) error {361 return autoConvert_flowcontrol_FlowSchemaSpec_To_v1alpha1_FlowSchemaSpec(in, out, s)362}363func autoConvert_v1alpha1_FlowSchemaStatus_To_flowcontrol_FlowSchemaStatus(in *v1alpha1.FlowSchemaStatus, out *flowcontrol.FlowSchemaStatus, s conversion.Scope) error {364 out.Conditions = *(*[]flowcontrol.FlowSchemaCondition)(unsafe.Pointer(&in.Conditions))365 return nil366}367// Convert_v1alpha1_FlowSchemaStatus_To_flowcontrol_FlowSchemaStatus is an autogenerated conversion function.368func Convert_v1alpha1_FlowSchemaStatus_To_flowcontrol_FlowSchemaStatus(in *v1alpha1.FlowSchemaStatus, out *flowcontrol.FlowSchemaStatus, s conversion.Scope) error {369 return autoConvert_v1alpha1_FlowSchemaStatus_To_flowcontrol_FlowSchemaStatus(in, out, s)370}371func autoConvert_flowcontrol_FlowSchemaStatus_To_v1alpha1_FlowSchemaStatus(in *flowcontrol.FlowSchemaStatus, out *v1alpha1.FlowSchemaStatus, s conversion.Scope) error {372 out.Conditions = *(*[]v1alpha1.FlowSchemaCondition)(unsafe.Pointer(&in.Conditions))373 return nil374}375// Convert_flowcontrol_FlowSchemaStatus_To_v1alpha1_FlowSchemaStatus is an autogenerated conversion function.376func Convert_flowcontrol_FlowSchemaStatus_To_v1alpha1_FlowSchemaStatus(in *flowcontrol.FlowSchemaStatus, out *v1alpha1.FlowSchemaStatus, s conversion.Scope) error {377 return autoConvert_flowcontrol_FlowSchemaStatus_To_v1alpha1_FlowSchemaStatus(in, out, s)378}379func autoConvert_v1alpha1_GroupSubject_To_flowcontrol_GroupSubject(in *v1alpha1.GroupSubject, out *flowcontrol.GroupSubject, s conversion.Scope) error {380 out.Name = in.Name381 return nil382}383// Convert_v1alpha1_GroupSubject_To_flowcontrol_GroupSubject is an autogenerated conversion function.384func Convert_v1alpha1_GroupSubject_To_flowcontrol_GroupSubject(in *v1alpha1.GroupSubject, out *flowcontrol.GroupSubject, s conversion.Scope) error {385 return autoConvert_v1alpha1_GroupSubject_To_flowcontrol_GroupSubject(in, out, s)386}387func autoConvert_flowcontrol_GroupSubject_To_v1alpha1_GroupSubject(in *flowcontrol.GroupSubject, out *v1alpha1.GroupSubject, s conversion.Scope) error {388 out.Name = in.Name389 return nil390}391// Convert_flowcontrol_GroupSubject_To_v1alpha1_GroupSubject is an autogenerated conversion function....
jsonschema_allow_nulls_test.go
Source:jsonschema_allow_nulls_test.go
...5 "github.com/sirupsen/logrus"6 "github.com/stretchr/testify/assert"7 "github.com/stretchr/testify/require"8)9func TestGenerateJSONSchemasAllowNullsFlatObject(t *testing.T) {10 var expectedSchema = `{11 "$schema": "http://json-schema.org/draft-04/schema#",12 "required": [13 "id",14 "name"15 ],16 "properties": {17 "id": {18 "additionalProperties": true,19 "oneOf": [20 {21 "type": "null"22 },23 {24 "type": "string"25 }26 ],27 "description": "Some ID",28 "format": "date-time"29 },30 "name": {31 "additionalProperties": true,32 "oneOf": [33 {34 "type": "null"35 },36 {37 "type": "string"38 }39 ],40 "description": "Some name"41 }42 },43 "additionalProperties": true,44 "oneOf": [45 {46 "type": "null"47 },48 {49 "type": "object"50 }51 ]52}`53 // Prepare a new schema converter:54 schemaConverter, err := New(&types.Config{55 AllowNullValues: true,56 BlockAdditionalProperties: false,57 JSONSchemaFileExtention: "jsonschema",58 SpecPath: "../samples/swagger2/flat-object.yaml",59 }, logrus.New())60 require.NoError(t, err)61 // Convert the spec:62 generatedJSONSchemas, err := schemaConverter.GenerateJSONSchemas()63 require.NoError(t, err)64 assert.NoError(t, err)65 assert.NotNil(t, generatedJSONSchemas)66 assert.Len(t, generatedJSONSchemas, 1)67 assert.JSONEq(t, expectedSchema, string(generatedJSONSchemas[0].Bytes))68}69func TestGenerateJSONSchemasAllowNullsFlatObjectWithEnum(t *testing.T) {70 var expectedSchema = `{71 "$schema": "http://json-schema.org/draft-04/schema#",72 "required": [73 "id",74 "name"75 ],76 "properties": {77 "id": {78 "additionalProperties": true,79 "enum": [80 "a",81 "b",82 "c"83 ],84 "oneOf": [85 {86 "type": "null"87 },88 {89 "type": "string"90 }91 ]92 }93 },94 "additionalProperties": true,95 "oneOf": [96 {97 "type": "null"98 },99 {100 "type": "object"101 }102 ]103}`104 // Prepare a new schema converter:105 schemaConverter, err := New(&types.Config{106 AllowNullValues: true,107 BlockAdditionalProperties: false,108 JSONSchemaFileExtention: "jsonschema",109 SpecPath: "../samples/swagger2/flat-object-with-enum.yaml",110 }, logrus.New())111 require.NoError(t, err)112 // Convert the spec:113 generatedJSONSchemas, err := schemaConverter.GenerateJSONSchemas()114 require.NoError(t, err)115 assert.NoError(t, err)116 assert.NotNil(t, generatedJSONSchemas)117 assert.Len(t, generatedJSONSchemas, 1)118 assert.JSONEq(t, expectedSchema, string(generatedJSONSchemas[0].Bytes))119}120func TestGenerateJSONSchemasAllowNullsObjectWithArrays(t *testing.T) {121 var expectedSchema = `{122 "$schema": "http://json-schema.org/draft-04/schema#",123 "required": [124 "group_id",125 "group_name",126 "contacts_schema"127 ],128 "properties": {129 "contacts_schema": {130 "items": {131 "required": [132 "email_address"133 ],134 "properties": {135 "email_address": {136 "additionalProperties": true,137 "oneOf": [138 {139 "type": "null"140 },141 {142 "type": "string"143 }144 ]145 },146 "first_name": {147 "additionalProperties": true,148 "oneOf": [149 {150 "type": "null"151 },152 {153 "type": "string"154 }155 ]156 },157 "last_name": {158 "additionalProperties": true,159 "oneOf": [160 {161 "type": "null"162 },163 {164 "type": "string"165 }166 ]167 },168 "phone_number": {169 "additionalProperties": true,170 "oneOf": [171 {172 "type": "null"173 },174 {175 "type": "string"176 }177 ]178 },179 "spam": {180 "additionalProperties": true,181 "oneOf": [182 {183 "type": "null"184 },185 {186 "type": "boolean"187 }188 ],189 "description": "Send this person spam?"190 }191 },192 "additionalProperties": true,193 "oneOf": [194 {195 "type": "null"196 },197 {198 "type": "object"199 }200 ]201 },202 "additionalProperties": true203 },204 "crufts": {205 "items": {206 "required": [207 "id"208 ],209 "properties": {210 "description": {211 "additionalProperties": true,212 "oneOf": [213 {214 "type": "null"215 },216 {217 "type": "string"218 }219 ]220 },221 "id": {222 "additionalProperties": true,223 "oneOf": [224 {225 "type": "null"226 },227 {228 "type": "integer"229 }230 ]231 }232 },233 "additionalProperties": true,234 "oneOf": [235 {236 "type": "null"237 },238 {239 "type": "object"240 }241 ]242 },243 "additionalProperties": true244 },245 "group_id": {246 "additionalProperties": true,247 "oneOf": [248 {249 "type": "null"250 },251 {252 "type": "integer"253 }254 ],255 "description": "Some ID"256 },257 "group_name": {258 "additionalProperties": true,259 "oneOf": [260 {261 "type": "null"262 },263 {264 "type": "string"265 }266 ],267 "description": "Some name"268 },269 "remarks": {270 "items": {271 "additionalProperties": true,272 "oneOf": [273 {274 "type": "null"275 },276 {277 "type": "string"278 }279 ]280 },281 "additionalProperties": true282 }283 },284 "additionalProperties": true,285 "oneOf": [286 {287 "type": "null"288 },289 {290 "type": "object"291 }292 ]293}`294 // Prepare a new schema converter:295 schemaConverter, err := New(&types.Config{296 AllowNullValues: true,297 BlockAdditionalProperties: false,298 JSONSchemaFileExtention: "jsonschema",299 SpecPath: "../samples/swagger2/array-of-referenced-object.yaml",300 }, logrus.New())301 require.NoError(t, err)302 // Convert the spec:303 generatedJSONSchemas, err := schemaConverter.GenerateJSONSchemas()304 require.NoError(t, err)305 assert.NoError(t, err)306 assert.NotNil(t, generatedJSONSchemas)307 assert.Len(t, generatedJSONSchemas, 2)308 assert.JSONEq(t, expectedSchema, string(generatedJSONSchemas[0].Bytes))309}310func TestGenerateJSONSchemasAllowNullsObjectWithPattern(t *testing.T) {311 var expectedSchema = `{312 "$schema": "http://json-schema.org/draft-04/schema#",313 "required": [314 "id",315 "name"316 ],317 "properties": {318 "id": {319 "additionalProperties": true,320 "oneOf": [321 {322 "type": "null"323 },324 {325 "type": "string"326 }327 ],328 "description": "Some ID"329 },330 "locale": {331 "pattern": "^[a-z]{2}(?:-[A-Z][a-z]{3})?(?:-(?:[A-Z]{2}))?$",332 "additionalProperties": true,333 "oneOf": [334 {335 "type": "null"336 },337 {338 "type": "string"339 }340 ],341 "description": "BCP 47 locale string"342 },343 "name": {344 "additionalProperties": true,345 "oneOf": [346 {347 "type": "null"348 },349 {350 "type": "string"351 }352 ],353 "description": "Some name"354 },355 "phone_number": {356 "pattern": "^[\\d|\\+|\\(]+[\\)|\\d|\\s|-]*[\\d]$",357 "additionalProperties": true,358 "oneOf": [359 {360 "type": "null"361 },362 {363 "type": "string"364 }365 ],366 "description": "Phone number"367 }368 },369 "additionalProperties": true,370 "oneOf": [371 {372 "type": "null"373 },374 {375 "type": "object"376 }377 ]378}`379 // Prepare a new schema converter:380 schemaConverter, err := New(&types.Config{381 AllowNullValues: true,382 BlockAdditionalProperties: false,383 JSONSchemaFileExtention: "jsonschema",384 SpecPath: "../samples/swagger2/object-with-pattern.yaml",385 }, logrus.New())386 require.NoError(t, err)387 // Convert the spec:388 generatedJSONSchemas, err := schemaConverter.GenerateJSONSchemas()389 require.NoError(t, err)390 assert.NoError(t, err)391 assert.NotNil(t, generatedJSONSchemas)392 assert.Len(t, generatedJSONSchemas, 1)393 assert.JSONEq(t, expectedSchema, string(generatedJSONSchemas[0].Bytes))394}395func TestGenerateJSONSchemasAllowNullsReferencedObject(t *testing.T) {396 var expectedSchema = `{397 "$schema": "http://json-schema.org/draft-04/schema#",398 "required": [399 "user_id",400 "user_name"401 ],402 "properties": {403 "contact_additional_props_map": {404 "additionalProperties": true,405 "oneOf": [406 {407 "type": "null"408 },409 {410 "type": "object"411 }412 ]413 },414 "contact_ref": {415 "required": [416 "email_address"417 ],418 "properties": {419 "email_address": {420 "additionalProperties": true,421 "oneOf": [422 {423 "type": "null"424 },425 {426 "type": "string"427 }428 ]429 },430 "first_name": {431 "additionalProperties": true,432 "oneOf": [433 {434 "type": "null"435 },436 {437 "type": "string"438 }439 ]440 },441 "last_name": {442 "additionalProperties": true,443 "oneOf": [444 {445 "type": "null"446 },447 {448 "type": "string"449 }450 ]451 },452 "phone_number": {453 "additionalProperties": true,454 "oneOf": [455 {456 "type": "null"457 },458 {459 "type": "string"460 }461 ]462 },463 "spam": {464 "additionalProperties": true,465 "oneOf": [466 {467 "type": "null"468 },469 {470 "type": "boolean"471 }472 ],473 "description": "Send this person spam?"474 }475 },476 "additionalProperties": true,477 "oneOf": [478 {479 "type": "null"480 },481 {482 "type": "object"483 }484 ]485 },486 "user_id": {487 "additionalProperties": true,488 "oneOf": [489 {490 "type": "null"491 },492 {493 "type": "integer"494 }495 ],496 "description": "Some ID"497 },498 "user_name": {499 "additionalProperties": true,500 "oneOf": [501 {502 "type": "null"503 },504 {505 "type": "string"506 }507 ],508 "description": "Some name"509 }510 },511 "additionalProperties": true,512 "oneOf": [513 {514 "type": "null"515 },516 {517 "type": "object"518 }519 ]520}`521 // Prepare a new schema converter:522 schemaConverter, err := New(&types.Config{523 AllowNullValues: true,524 BlockAdditionalProperties: false,525 JSONSchemaFileExtention: "jsonschema",526 SpecPath: "../samples/swagger2/referenced-object.yaml",527 }, logrus.New())528 require.NoError(t, err)529 // Convert the spec:530 generatedJSONSchemas, err := schemaConverter.GenerateJSONSchemas()531 require.NoError(t, err)532 assert.NoError(t, err)533 assert.NotNil(t, generatedJSONSchemas)534 assert.Len(t, generatedJSONSchemas, 2)535 assert.JSONEq(t, expectedSchema, string(generatedJSONSchemas[0].Bytes))536}537func TestGenerateJSONSchemasAllowNullsNumberWithMinMax(t *testing.T) {538 var expectedSchema = `{539 "$schema": "http://json-schema.org/draft-04/schema#",540 "required": [541 "latitude"542 ],543 "properties": {544 "description": {545 "minLength": 1,546 "maxLength": 10,547 "additionalProperties": true,548 "oneOf": [549 {550 "type": "null"551 },552 {553 "type": "string"554 }555 ]556 },557 "latitude": {558 "maximum": 90,559 "minimum": -90,560 "additionalProperties": true,561 "oneOf": [562 {563 "type": "null"564 },565 {566 "type": "number"567 }568 ],569 "description": "The latitude in degrees. It must be in the range [-90.0, +90.0]",570 "format": "double"571 }572 },573 "additionalProperties": true,574 "oneOf": [575 {576 "type": "null"577 },578 {579 "type": "object"580 }581 ],582 "description": "Specifies a geographic location in terms of its Latitude and Longitude"583}`584 // Prepare a new schema converter:585 schemaConverter, err := New(&types.Config{586 AllowNullValues: true,587 BlockAdditionalProperties: false,588 JSONSchemaFileExtention: "jsonschema",589 SpecPath: "../samples/swagger2/flat-object-with-number-options.yaml",590 }, logrus.New())591 require.NoError(t, err)592 // Convert the spec:593 generatedJSONSchemas, err := schemaConverter.GenerateJSONSchemas()594 require.NoError(t, err)595 assert.NoError(t, err)596 assert.NotNil(t, generatedJSONSchemas)597 assert.Len(t, generatedJSONSchemas, 1)598 assert.JSONEq(t, expectedSchema, string(generatedJSONSchemas[0].Bytes))599}600func TestGenerateJSONSchemasMapAllowingNullValues(t *testing.T) {601 var expectedSchema = `{602 "$schema": "http://json-schema.org/draft-04/schema#",603 "additionalProperties": {604 "type": "string"605 },606 "oneOf": [607 {608 "type": "null"609 },610 {611 "type": "object"612 }613 ]614}`615 // Prepare a new schema converter:616 schemaConverter, err := New(&types.Config{617 AllowNullValues: true,618 BlockAdditionalProperties: false,619 JSONSchemaFileExtention: "jsonschema",620 SpecPath: "../samples/swagger2/with_map.yaml",621 }, logrus.New())622 require.NoError(t, err)623 // Convert the spec:624 generatedJSONSchemas, err := schemaConverter.GenerateJSONSchemas()625 require.NoError(t, err)626 assert.NoError(t, err)627 assert.NotNil(t, generatedJSONSchemas)628 assert.Len(t, generatedJSONSchemas, 1)629 assert.JSONEq(t, expectedSchema, string(generatedJSONSchemas[0].Bytes))630}631func TestGenerateJSONSchemasMapInAReffedObjectAllowingNullValues(t *testing.T) {632 var expectedSchema = `{633 "$schema": "http://json-schema.org/draft-04/schema#",634 "properties": {635 "object_with_map": {636 "additionalProperties": {637 "type": "string"638 },639 "oneOf": [640 {641 "type": "null"642 },643 {644 "type": "object"645 }646 ]647 }648 },649 "additionalProperties": true,650 "oneOf": [651 {652 "type": "null"653 },654 {655 "type": "object"656 }657 ]658}`659 // Prepare a new schema converter:660 schemaConverter, err := New(&types.Config{661 AllowNullValues: true,662 BlockAdditionalProperties: false,663 JSONSchemaFileExtention: "jsonschema",664 SpecPath: "../samples/swagger2/with_map_in_ref.yaml",665 }, logrus.New())666 require.NoError(t, err)667 // Convert the spec:668 generatedJSONSchemas, err := schemaConverter.GenerateJSONSchemas()669 require.NoError(t, err)670 assert.NoError(t, err)671 assert.NotNil(t, generatedJSONSchemas)672 assert.Len(t, generatedJSONSchemas, 2)673 assert.JSONEq(t, expectedSchema, string(generatedJSONSchemas[1].Bytes))674}675func TestGenerateJSONSchemasMapInAReffedObjectAllowingNullValues2(t *testing.T) {676 var expectedSchema = `{677 "$schema": "http://json-schema.org/draft-04/schema#",678 "properties": {679 "object_with_map": {680 "additionalProperties": {681 "type": "string"682 },683 "oneOf": [684 {685 "type": "null"686 },687 {688 "type": "object"689 }690 ]691 }692 },693 "additionalProperties": true,694 "oneOf": [695 {696 "type": "null"697 },698 {699 "type": "object"700 }701 ]702}`703 // Prepare a new schema converter:704 schemaConverter, err := New(&types.Config{705 AllowNullValues: true,706 BlockAdditionalProperties: false,707 JSONSchemaFileExtention: "jsonschema",708 SpecPath: "../samples/swagger2/with_map_in_ref_2.yaml",709 }, logrus.New())710 require.NoError(t, err)711 // Convert the spec:712 generatedJSONSchemas, err := schemaConverter.GenerateJSONSchemas()713 require.NoError(t, err)714 assert.NoError(t, err)715 assert.NotNil(t, generatedJSONSchemas)716 assert.Len(t, generatedJSONSchemas, 2)717 assert.JSONEq(t, expectedSchema, string(generatedJSONSchemas[1].Bytes))718}...
Schema
Using AI Code Generation
1import (2func main() {3 req := plugin.Request{}4 if err := req.Read(os.Stdin); err != nil {5 log.Fatal(err)6 }7 resp := plugin.Response{}8 for _, f := range req.GetProtoFile() {9 for _, m := range f.GetMessageType() {10 if gormable, err := options.IsGormable(m); err == nil && gormable {11 t := template.Must(template.New("schema").Parse(schemaTemplate))12 if err := t.Execute(os.Stdout, m); err != nil {13 log.Fatal(err)14 }15 }16 }17 }18 if err := resp.Write(os.Stdout); err != nil {19 log.Fatal(err)20 }21}22func (m *{{ .GetName }}) Schema() *gorm.DB {23 {{- range .GetField }}24 {{- if .GetOrmTag }}25 {{- else }}26 {{- end }}27 {{- end }}28 {{- if .GetOrmTag }}29 {{- end }}30 {{- range .GetOneofDecl }}31 {{- range .GetOneofField }}32 {{- if .GetOrmTag }}33 {{- else }}34 {{- end }}35 {{- end }}36 {{- end }}37}38import (
Schema
Using AI Code Generation
1import (2func main() {3 goljson.Schema("1.json")4 fmt.Println("Schema generated!")5}6{7 "schema": {8 "properties": {9 "Name": {10 },11 "Age": {12 },13 "Address": {14 }15 },16 }17}18import (19func main() {20 fmt.Println(goljson.Schema("1.json"))21}22{23 "schema": {24 "properties": {25 "Name": {26 },27 "Age": {28 },29 "Address": {30 }31 },32 }33}34import (35func main() {36 fmt.Println(goljson.Schema("2.json"))37}38{39 "schema": {40 "properties": {41 "Name": {42 },43 "Age": {44 },45 "Address": {46 }47 },48 }49}50import (51func main() {52 fmt.Println(goljson.Schema("3.json"))53}54{55 "schema": {56 "properties": {57 "Name": {58 },59 "Age": {60 },61 "Address": {62 }
Schema
Using AI Code Generation
1import (2func main() {3 feed := feed.New()4 err := feed.LoadFile("feed.xml")5 if err != nil {6 fmt.Println(err)7 }8 fmt.Println(feed.Channel.Title)9}10import (11func main() {12 feed := feed.New()13 err := feed.LoadFile("feed.xml")14 if err != nil {15 fmt.Println(err)16 }17 xml, err := feed.MarshalXML()18 if err != nil {19 fmt.Println(err)20 }21 fmt.Println(xml)22}23import (24func main() {25 feed := feed.New()26 err := feed.LoadFile("feed.xml")27 if err != nil {28 fmt.Println(err)29 }30 xml, err := feed.MarshalXML()31 if err != nil {32 fmt.Println(err)33 }34 feed = feed.New()35 err = feed.UnmarshalXML(xml)36 if err != nil {37 fmt.Println(err)38 }39 fmt.Println(feed.Channel.Title)40}41import (42func main() {43 feed := feed.New()44 err := feed.LoadFile("feed.xml")45 if err != nil {46 fmt.Println(err)47 }48 xml, err := feed.MarshalXML(feed.Namespace)49 if err != nil {50 fmt.Println(err)51 }52 fmt.Println(xml)53}54import (55func main() {56 feed := feed.New()57 err := feed.LoadFile("feed.xml")58 if err != nil {59 fmt.Println(err)60 }61 xml, err := feed.MarshalXML(feed.Namespace)62 if err != nil {
Schema
Using AI Code Generation
1import (2func main() {3 x := yourprojectname.New()4 fmt.Println(x.Schema())5}6import (7func main() {8 x := yourprojectname.New()9 fmt.Println(x.Schema())10}11{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"status":{"type":"string"}}}12{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"status":{"type":"string"}}}13{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"status":{"type":"string"}}}14{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"status":{"type":"string"}}}15import (16type Pet struct {17}18func (m *Pet) Validate(formats strfmt.Registry) error {19}20func (m *Pet) MarshalBinary() ([]byte, error) {21 if m == nil {22 }23 return swag.WriteJSON(m)24}25func (m *Pet) Unmarshal
Schema
Using AI Code Generation
1import (2func main() {3 schema := xmlschema.NewSchema()4 schema.Schema()5 fmt.Println(schema.Output)6}7import (8func main() {9 schema := xmlschema.NewSchema()10 schema.Schema()11 fmt.Println(schema.Output)12}13import (14func main() {15 schema := xmlschema.NewSchema()16 schema.Schema()17 fmt.Println(schema.Output)18}19import (20func main() {21 schema := xmlschema.NewSchema()22 schema.Schema()23 fmt.Println(schema.Output)24}25import (26func main() {27 schema := xmlschema.NewSchema()28 schema.Schema()29 fmt.Println(schema.Output)30}31import (32func main() {
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!