MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / ValidateFields

Method ValidateFields

pkg/ttnpb/user.pb.validate.go:263–551  ·  view source on GitHub ↗

ValidateFields checks the field values on User with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

(paths ...string)

Source from the content-addressed store, hash-verified

261// ValidateFields checks the field values on User with the rules defined in the
262// proto definition for this message. If any rules are violated, an error is returned.
263func (m *User) ValidateFields(paths ...string) error {
264 if m == nil {
265 return nil
266 }
267
268 if len(paths) == 0 {
269 paths = UserFieldPathsNested
270 }
271
272 for name, subs := range _processPaths(append(paths[:0:0], paths...)) {
273 _ = subs
274 switch name {
275 case "ids":
276
277 if m.GetIds() == nil {
278 return UserValidationError{
279 field: "ids",
280 reason: "value is required",
281 }
282 }
283
284 if v, ok := interface{}(m.GetIds()).(interface{ ValidateFields(...string) error }); ok {
285 if err := v.ValidateFields(subs...); err != nil {
286 return UserValidationError{
287 field: "ids",
288 reason: "embedded message failed validation",
289 cause: err,
290 }
291 }
292 }
293
294 case "created_at":
295
296 if v, ok := interface{}(m.GetCreatedAt()).(interface{ ValidateFields(...string) error }); ok {
297 if err := v.ValidateFields(subs...); err != nil {
298 return UserValidationError{
299 field: "created_at",
300 reason: "embedded message failed validation",
301 cause: err,
302 }
303 }
304 }
305
306 case "updated_at":
307
308 if v, ok := interface{}(m.GetUpdatedAt()).(interface{ ValidateFields(...string) error }); ok {
309 if err := v.ValidateFields(subs...); err != nil {
310 return UserValidationError{
311 field: "updated_at",
312 reason: "embedded message failed validation",
313 cause: err,
314 }
315 }
316 }
317
318 case "deleted_at":
319
320 if v, ok := interface{}(m.GetDeletedAt()).(interface{ ValidateFields(...string) error }); ok {

Callers 15

validateSubscribeMethod · 0.45
handleUpstreamMethod · 0.45
HandleUpMethod · 0.45
HandleStatusMethod · 0.45
HandleTxAckMethod · 0.45
ValidateContextMethod · 0.45
ValidateFieldsMethod · 0.45
ValidateFieldsMethod · 0.45
ValidateFieldsMethod · 0.45
ValidateFieldsMethod · 0.45
ValidateFieldsMethod · 0.45
ValidateFieldsMethod · 0.45

Calls 15

GetIdsMethod · 0.95
GetCreatedAtMethod · 0.95
GetUpdatedAtMethod · 0.95
GetDeletedAtMethod · 0.95
GetNameMethod · 0.95
GetDescriptionMethod · 0.95
GetAttributesMethod · 0.95
GetContactInfoMethod · 0.95
_validateEmailMethod · 0.95
GetPasswordMethod · 0.95

Tested by 1