• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

s7techlab / hlf-sdk-go / 6615655079

23 Oct 2023 03:42PM UTC coverage: 4.092% (-1.7%) from 5.771%
6615655079

Pull #135

github

Nikita Neznaemov
write-struct 15
Pull Request #135: write-struct

2885 of 2885 new or added lines in 21 files covered. (100.0%)

446 of 10900 relevant lines covered (4.09%)

0.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/block/block.pb.validate.go
1
// Code generated by protoc-gen-validate. DO NOT EDIT.
2
// source: block.proto
3

4
package block
5

6
import (
7
        "bytes"
8
        "errors"
9
        "fmt"
10
        "net"
11
        "net/mail"
12
        "net/url"
13
        "regexp"
14
        "sort"
15
        "strings"
16
        "time"
17
        "unicode/utf8"
18

19
        "google.golang.org/protobuf/types/known/anypb"
20

21
        peer "github.com/hyperledger/fabric-protos-go/peer"
22
)
23

24
// ensure the imports are used
25
var (
26
        _ = bytes.MinRead
27
        _ = errors.New("")
28
        _ = fmt.Print
29
        _ = utf8.UTFMax
30
        _ = (*regexp.Regexp)(nil)
31
        _ = (*strings.Reader)(nil)
32
        _ = net.IPv4len
33
        _ = time.Duration(0)
34
        _ = (*url.URL)(nil)
35
        _ = (*mail.Address)(nil)
36
        _ = anypb.Any{}
37
        _ = sort.Sort
38

39
        _ = peer.TxValidationCode(0)
40
)
41

42
// Validate checks the field values on Block with the rules defined in the
43
// proto definition for this message. If any rules are violated, the first
44
// error encountered is returned, or nil if there are no violations.
45
func (m *Block) Validate() error {
×
46
        return m.validate(false)
×
47
}
×
48

49
// ValidateAll checks the field values on Block with the rules defined in the
50
// proto definition for this message. If any rules are violated, the result is
51
// a list of violation errors wrapped in BlockMultiError, or nil if none found.
52
func (m *Block) ValidateAll() error {
×
53
        return m.validate(true)
×
54
}
×
55

56
func (m *Block) validate(all bool) error {
×
57
        if m == nil {
×
58
                return nil
×
59
        }
×
60

61
        var errors []error
×
62

×
63
        if all {
×
64
                switch v := interface{}(m.GetHeader()).(type) {
×
65
                case interface{ ValidateAll() error }:
×
66
                        if err := v.ValidateAll(); err != nil {
×
67
                                errors = append(errors, BlockValidationError{
×
68
                                        field:  "Header",
×
69
                                        reason: "embedded message failed validation",
×
70
                                        cause:  err,
×
71
                                })
×
72
                        }
×
73
                case interface{ Validate() error }:
×
74
                        if err := v.Validate(); err != nil {
×
75
                                errors = append(errors, BlockValidationError{
×
76
                                        field:  "Header",
×
77
                                        reason: "embedded message failed validation",
×
78
                                        cause:  err,
×
79
                                })
×
80
                        }
×
81
                }
82
        } else if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok {
×
83
                if err := v.Validate(); err != nil {
×
84
                        return BlockValidationError{
×
85
                                field:  "Header",
×
86
                                reason: "embedded message failed validation",
×
87
                                cause:  err,
×
88
                        }
×
89
                }
×
90
        }
91

92
        if all {
×
93
                switch v := interface{}(m.GetData()).(type) {
×
94
                case interface{ ValidateAll() error }:
×
95
                        if err := v.ValidateAll(); err != nil {
×
96
                                errors = append(errors, BlockValidationError{
×
97
                                        field:  "Data",
×
98
                                        reason: "embedded message failed validation",
×
99
                                        cause:  err,
×
100
                                })
×
101
                        }
×
102
                case interface{ Validate() error }:
×
103
                        if err := v.Validate(); err != nil {
×
104
                                errors = append(errors, BlockValidationError{
×
105
                                        field:  "Data",
×
106
                                        reason: "embedded message failed validation",
×
107
                                        cause:  err,
×
108
                                })
×
109
                        }
×
110
                }
111
        } else if v, ok := interface{}(m.GetData()).(interface{ Validate() error }); ok {
×
112
                if err := v.Validate(); err != nil {
×
113
                        return BlockValidationError{
×
114
                                field:  "Data",
×
115
                                reason: "embedded message failed validation",
×
116
                                cause:  err,
×
117
                        }
×
118
                }
×
119
        }
120

121
        if all {
×
122
                switch v := interface{}(m.GetMetadata()).(type) {
×
123
                case interface{ ValidateAll() error }:
×
124
                        if err := v.ValidateAll(); err != nil {
×
125
                                errors = append(errors, BlockValidationError{
×
126
                                        field:  "Metadata",
×
127
                                        reason: "embedded message failed validation",
×
128
                                        cause:  err,
×
129
                                })
×
130
                        }
×
131
                case interface{ Validate() error }:
×
132
                        if err := v.Validate(); err != nil {
×
133
                                errors = append(errors, BlockValidationError{
×
134
                                        field:  "Metadata",
×
135
                                        reason: "embedded message failed validation",
×
136
                                        cause:  err,
×
137
                                })
×
138
                        }
×
139
                }
140
        } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
×
141
                if err := v.Validate(); err != nil {
×
142
                        return BlockValidationError{
×
143
                                field:  "Metadata",
×
144
                                reason: "embedded message failed validation",
×
145
                                cause:  err,
×
146
                        }
×
147
                }
×
148
        }
149

150
        if len(errors) > 0 {
×
151
                return BlockMultiError(errors)
×
152
        }
×
153

154
        return nil
×
155
}
156

157
// BlockMultiError is an error wrapping multiple validation errors returned by
158
// Block.ValidateAll() if the designated constraints aren't met.
159
type BlockMultiError []error
160

161
// Error returns a concatenation of all the error messages it wraps.
162
func (m BlockMultiError) Error() string {
×
163
        var msgs []string
×
164
        for _, err := range m {
×
165
                msgs = append(msgs, err.Error())
×
166
        }
×
167
        return strings.Join(msgs, "; ")
×
168
}
169

170
// AllErrors returns a list of validation violation errors.
171
func (m BlockMultiError) AllErrors() []error { return m }
×
172

173
// BlockValidationError is the validation error returned by Block.Validate if
174
// the designated constraints aren't met.
175
type BlockValidationError struct {
176
        field  string
177
        reason string
178
        cause  error
179
        key    bool
180
}
181

182
// Field function returns field value.
183
func (e BlockValidationError) Field() string { return e.field }
×
184

185
// Reason function returns reason value.
186
func (e BlockValidationError) Reason() string { return e.reason }
×
187

188
// Cause function returns cause value.
189
func (e BlockValidationError) Cause() error { return e.cause }
×
190

191
// Key function returns key value.
192
func (e BlockValidationError) Key() bool { return e.key }
×
193

194
// ErrorName returns error name.
195
func (e BlockValidationError) ErrorName() string { return "BlockValidationError" }
×
196

197
// Error satisfies the builtin error interface
198
func (e BlockValidationError) Error() string {
×
199
        cause := ""
×
200
        if e.cause != nil {
×
201
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
202
        }
×
203

204
        key := ""
×
205
        if e.key {
×
206
                key = "key for "
×
207
        }
×
208

209
        return fmt.Sprintf(
×
210
                "invalid %sBlock.%s: %s%s",
×
211
                key,
×
212
                e.field,
×
213
                e.reason,
×
214
                cause)
×
215
}
216

217
var _ error = BlockValidationError{}
218

219
var _ interface {
220
        Field() string
221
        Reason() string
222
        Key() bool
223
        Cause() error
224
        ErrorName() string
225
} = BlockValidationError{}
226

227
// Validate checks the field values on BlockData with the rules defined in the
228
// proto definition for this message. If any rules are violated, the first
229
// error encountered is returned, or nil if there are no violations.
230
func (m *BlockData) Validate() error {
×
231
        return m.validate(false)
×
232
}
×
233

234
// ValidateAll checks the field values on BlockData with the rules defined in
235
// the proto definition for this message. If any rules are violated, the
236
// result is a list of violation errors wrapped in BlockDataMultiError, or nil
237
// if none found.
238
func (m *BlockData) ValidateAll() error {
×
239
        return m.validate(true)
×
240
}
×
241

242
func (m *BlockData) validate(all bool) error {
×
243
        if m == nil {
×
244
                return nil
×
245
        }
×
246

247
        var errors []error
×
248

×
249
        for idx, item := range m.GetEnvelopes() {
×
250
                _, _ = idx, item
×
251

×
252
                if all {
×
253
                        switch v := interface{}(item).(type) {
×
254
                        case interface{ ValidateAll() error }:
×
255
                                if err := v.ValidateAll(); err != nil {
×
256
                                        errors = append(errors, BlockDataValidationError{
×
257
                                                field:  fmt.Sprintf("Envelopes[%v]", idx),
×
258
                                                reason: "embedded message failed validation",
×
259
                                                cause:  err,
×
260
                                        })
×
261
                                }
×
262
                        case interface{ Validate() error }:
×
263
                                if err := v.Validate(); err != nil {
×
264
                                        errors = append(errors, BlockDataValidationError{
×
265
                                                field:  fmt.Sprintf("Envelopes[%v]", idx),
×
266
                                                reason: "embedded message failed validation",
×
267
                                                cause:  err,
×
268
                                        })
×
269
                                }
×
270
                        }
271
                } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
×
272
                        if err := v.Validate(); err != nil {
×
273
                                return BlockDataValidationError{
×
274
                                        field:  fmt.Sprintf("Envelopes[%v]", idx),
×
275
                                        reason: "embedded message failed validation",
×
276
                                        cause:  err,
×
277
                                }
×
278
                        }
×
279
                }
280

281
        }
282

283
        if len(errors) > 0 {
×
284
                return BlockDataMultiError(errors)
×
285
        }
×
286

287
        return nil
×
288
}
289

290
// BlockDataMultiError is an error wrapping multiple validation errors returned
291
// by BlockData.ValidateAll() if the designated constraints aren't met.
292
type BlockDataMultiError []error
293

294
// Error returns a concatenation of all the error messages it wraps.
295
func (m BlockDataMultiError) Error() string {
×
296
        var msgs []string
×
297
        for _, err := range m {
×
298
                msgs = append(msgs, err.Error())
×
299
        }
×
300
        return strings.Join(msgs, "; ")
×
301
}
302

303
// AllErrors returns a list of validation violation errors.
304
func (m BlockDataMultiError) AllErrors() []error { return m }
×
305

306
// BlockDataValidationError is the validation error returned by
307
// BlockData.Validate if the designated constraints aren't met.
308
type BlockDataValidationError struct {
309
        field  string
310
        reason string
311
        cause  error
312
        key    bool
313
}
314

315
// Field function returns field value.
316
func (e BlockDataValidationError) Field() string { return e.field }
×
317

318
// Reason function returns reason value.
319
func (e BlockDataValidationError) Reason() string { return e.reason }
×
320

321
// Cause function returns cause value.
322
func (e BlockDataValidationError) Cause() error { return e.cause }
×
323

324
// Key function returns key value.
325
func (e BlockDataValidationError) Key() bool { return e.key }
×
326

327
// ErrorName returns error name.
328
func (e BlockDataValidationError) ErrorName() string { return "BlockDataValidationError" }
×
329

330
// Error satisfies the builtin error interface
331
func (e BlockDataValidationError) Error() string {
×
332
        cause := ""
×
333
        if e.cause != nil {
×
334
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
335
        }
×
336

337
        key := ""
×
338
        if e.key {
×
339
                key = "key for "
×
340
        }
×
341

342
        return fmt.Sprintf(
×
343
                "invalid %sBlockData.%s: %s%s",
×
344
                key,
×
345
                e.field,
×
346
                e.reason,
×
347
                cause)
×
348
}
349

350
var _ error = BlockDataValidationError{}
351

352
var _ interface {
353
        Field() string
354
        Reason() string
355
        Key() bool
356
        Cause() error
357
        ErrorName() string
358
} = BlockDataValidationError{}
359

360
// Validate checks the field values on Envelope with the rules defined in the
361
// proto definition for this message. If any rules are violated, the first
362
// error encountered is returned, or nil if there are no violations.
363
func (m *Envelope) Validate() error {
×
364
        return m.validate(false)
×
365
}
×
366

367
// ValidateAll checks the field values on Envelope with the rules defined in
368
// the proto definition for this message. If any rules are violated, the
369
// result is a list of violation errors wrapped in EnvelopeMultiError, or nil
370
// if none found.
371
func (m *Envelope) ValidateAll() error {
×
372
        return m.validate(true)
×
373
}
×
374

375
func (m *Envelope) validate(all bool) error {
×
376
        if m == nil {
×
377
                return nil
×
378
        }
×
379

380
        var errors []error
×
381

×
382
        if all {
×
383
                switch v := interface{}(m.GetPayload()).(type) {
×
384
                case interface{ ValidateAll() error }:
×
385
                        if err := v.ValidateAll(); err != nil {
×
386
                                errors = append(errors, EnvelopeValidationError{
×
387
                                        field:  "Payload",
×
388
                                        reason: "embedded message failed validation",
×
389
                                        cause:  err,
×
390
                                })
×
391
                        }
×
392
                case interface{ Validate() error }:
×
393
                        if err := v.Validate(); err != nil {
×
394
                                errors = append(errors, EnvelopeValidationError{
×
395
                                        field:  "Payload",
×
396
                                        reason: "embedded message failed validation",
×
397
                                        cause:  err,
×
398
                                })
×
399
                        }
×
400
                }
401
        } else if v, ok := interface{}(m.GetPayload()).(interface{ Validate() error }); ok {
×
402
                if err := v.Validate(); err != nil {
×
403
                        return EnvelopeValidationError{
×
404
                                field:  "Payload",
×
405
                                reason: "embedded message failed validation",
×
406
                                cause:  err,
×
407
                        }
×
408
                }
×
409
        }
410

411
        // no validation rules for Signature
412

413
        // no validation rules for ValidationCode
414

415
        if len(errors) > 0 {
×
416
                return EnvelopeMultiError(errors)
×
417
        }
×
418

419
        return nil
×
420
}
421

422
// EnvelopeMultiError is an error wrapping multiple validation errors returned
423
// by Envelope.ValidateAll() if the designated constraints aren't met.
424
type EnvelopeMultiError []error
425

426
// Error returns a concatenation of all the error messages it wraps.
427
func (m EnvelopeMultiError) Error() string {
×
428
        var msgs []string
×
429
        for _, err := range m {
×
430
                msgs = append(msgs, err.Error())
×
431
        }
×
432
        return strings.Join(msgs, "; ")
×
433
}
434

435
// AllErrors returns a list of validation violation errors.
436
func (m EnvelopeMultiError) AllErrors() []error { return m }
×
437

438
// EnvelopeValidationError is the validation error returned by
439
// Envelope.Validate if the designated constraints aren't met.
440
type EnvelopeValidationError struct {
441
        field  string
442
        reason string
443
        cause  error
444
        key    bool
445
}
446

447
// Field function returns field value.
448
func (e EnvelopeValidationError) Field() string { return e.field }
×
449

450
// Reason function returns reason value.
451
func (e EnvelopeValidationError) Reason() string { return e.reason }
×
452

453
// Cause function returns cause value.
454
func (e EnvelopeValidationError) Cause() error { return e.cause }
×
455

456
// Key function returns key value.
457
func (e EnvelopeValidationError) Key() bool { return e.key }
×
458

459
// ErrorName returns error name.
460
func (e EnvelopeValidationError) ErrorName() string { return "EnvelopeValidationError" }
×
461

462
// Error satisfies the builtin error interface
463
func (e EnvelopeValidationError) Error() string {
×
464
        cause := ""
×
465
        if e.cause != nil {
×
466
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
467
        }
×
468

469
        key := ""
×
470
        if e.key {
×
471
                key = "key for "
×
472
        }
×
473

474
        return fmt.Sprintf(
×
475
                "invalid %sEnvelope.%s: %s%s",
×
476
                key,
×
477
                e.field,
×
478
                e.reason,
×
479
                cause)
×
480
}
481

482
var _ error = EnvelopeValidationError{}
483

484
var _ interface {
485
        Field() string
486
        Reason() string
487
        Key() bool
488
        Cause() error
489
        ErrorName() string
490
} = EnvelopeValidationError{}
491

492
// Validate checks the field values on Payload with the rules defined in the
493
// proto definition for this message. If any rules are violated, the first
494
// error encountered is returned, or nil if there are no violations.
495
func (m *Payload) Validate() error {
×
496
        return m.validate(false)
×
497
}
×
498

499
// ValidateAll checks the field values on Payload with the rules defined in the
500
// proto definition for this message. If any rules are violated, the result is
501
// a list of violation errors wrapped in PayloadMultiError, or nil if none found.
502
func (m *Payload) ValidateAll() error {
×
503
        return m.validate(true)
×
504
}
×
505

506
func (m *Payload) validate(all bool) error {
×
507
        if m == nil {
×
508
                return nil
×
509
        }
×
510

511
        var errors []error
×
512

×
513
        if all {
×
514
                switch v := interface{}(m.GetHeader()).(type) {
×
515
                case interface{ ValidateAll() error }:
×
516
                        if err := v.ValidateAll(); err != nil {
×
517
                                errors = append(errors, PayloadValidationError{
×
518
                                        field:  "Header",
×
519
                                        reason: "embedded message failed validation",
×
520
                                        cause:  err,
×
521
                                })
×
522
                        }
×
523
                case interface{ Validate() error }:
×
524
                        if err := v.Validate(); err != nil {
×
525
                                errors = append(errors, PayloadValidationError{
×
526
                                        field:  "Header",
×
527
                                        reason: "embedded message failed validation",
×
528
                                        cause:  err,
×
529
                                })
×
530
                        }
×
531
                }
532
        } else if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok {
×
533
                if err := v.Validate(); err != nil {
×
534
                        return PayloadValidationError{
×
535
                                field:  "Header",
×
536
                                reason: "embedded message failed validation",
×
537
                                cause:  err,
×
538
                        }
×
539
                }
×
540
        }
541

542
        if all {
×
543
                switch v := interface{}(m.GetTransaction()).(type) {
×
544
                case interface{ ValidateAll() error }:
×
545
                        if err := v.ValidateAll(); err != nil {
×
546
                                errors = append(errors, PayloadValidationError{
×
547
                                        field:  "Transaction",
×
548
                                        reason: "embedded message failed validation",
×
549
                                        cause:  err,
×
550
                                })
×
551
                        }
×
552
                case interface{ Validate() error }:
×
553
                        if err := v.Validate(); err != nil {
×
554
                                errors = append(errors, PayloadValidationError{
×
555
                                        field:  "Transaction",
×
556
                                        reason: "embedded message failed validation",
×
557
                                        cause:  err,
×
558
                                })
×
559
                        }
×
560
                }
561
        } else if v, ok := interface{}(m.GetTransaction()).(interface{ Validate() error }); ok {
×
562
                if err := v.Validate(); err != nil {
×
563
                        return PayloadValidationError{
×
564
                                field:  "Transaction",
×
565
                                reason: "embedded message failed validation",
×
566
                                cause:  err,
×
567
                        }
×
568
                }
×
569
        }
570

571
        // no validation rules for RawUnparsedTransaction
572

573
        if len(errors) > 0 {
×
574
                return PayloadMultiError(errors)
×
575
        }
×
576

577
        return nil
×
578
}
579

580
// PayloadMultiError is an error wrapping multiple validation errors returned
581
// by Payload.ValidateAll() if the designated constraints aren't met.
582
type PayloadMultiError []error
583

584
// Error returns a concatenation of all the error messages it wraps.
585
func (m PayloadMultiError) Error() string {
×
586
        var msgs []string
×
587
        for _, err := range m {
×
588
                msgs = append(msgs, err.Error())
×
589
        }
×
590
        return strings.Join(msgs, "; ")
×
591
}
592

593
// AllErrors returns a list of validation violation errors.
594
func (m PayloadMultiError) AllErrors() []error { return m }
×
595

596
// PayloadValidationError is the validation error returned by Payload.Validate
597
// if the designated constraints aren't met.
598
type PayloadValidationError struct {
599
        field  string
600
        reason string
601
        cause  error
602
        key    bool
603
}
604

605
// Field function returns field value.
606
func (e PayloadValidationError) Field() string { return e.field }
×
607

608
// Reason function returns reason value.
609
func (e PayloadValidationError) Reason() string { return e.reason }
×
610

611
// Cause function returns cause value.
612
func (e PayloadValidationError) Cause() error { return e.cause }
×
613

614
// Key function returns key value.
615
func (e PayloadValidationError) Key() bool { return e.key }
×
616

617
// ErrorName returns error name.
618
func (e PayloadValidationError) ErrorName() string { return "PayloadValidationError" }
×
619

620
// Error satisfies the builtin error interface
621
func (e PayloadValidationError) Error() string {
×
622
        cause := ""
×
623
        if e.cause != nil {
×
624
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
625
        }
×
626

627
        key := ""
×
628
        if e.key {
×
629
                key = "key for "
×
630
        }
×
631

632
        return fmt.Sprintf(
×
633
                "invalid %sPayload.%s: %s%s",
×
634
                key,
×
635
                e.field,
×
636
                e.reason,
×
637
                cause)
×
638
}
639

640
var _ error = PayloadValidationError{}
641

642
var _ interface {
643
        Field() string
644
        Reason() string
645
        Key() bool
646
        Cause() error
647
        ErrorName() string
648
} = PayloadValidationError{}
649

650
// Validate checks the field values on Header with the rules defined in the
651
// proto definition for this message. If any rules are violated, the first
652
// error encountered is returned, or nil if there are no violations.
653
func (m *Header) Validate() error {
×
654
        return m.validate(false)
×
655
}
×
656

657
// ValidateAll checks the field values on Header with the rules defined in the
658
// proto definition for this message. If any rules are violated, the result is
659
// a list of violation errors wrapped in HeaderMultiError, or nil if none found.
660
func (m *Header) ValidateAll() error {
×
661
        return m.validate(true)
×
662
}
×
663

664
func (m *Header) validate(all bool) error {
×
665
        if m == nil {
×
666
                return nil
×
667
        }
×
668

669
        var errors []error
×
670

×
671
        if all {
×
672
                switch v := interface{}(m.GetChannelHeader()).(type) {
×
673
                case interface{ ValidateAll() error }:
×
674
                        if err := v.ValidateAll(); err != nil {
×
675
                                errors = append(errors, HeaderValidationError{
×
676
                                        field:  "ChannelHeader",
×
677
                                        reason: "embedded message failed validation",
×
678
                                        cause:  err,
×
679
                                })
×
680
                        }
×
681
                case interface{ Validate() error }:
×
682
                        if err := v.Validate(); err != nil {
×
683
                                errors = append(errors, HeaderValidationError{
×
684
                                        field:  "ChannelHeader",
×
685
                                        reason: "embedded message failed validation",
×
686
                                        cause:  err,
×
687
                                })
×
688
                        }
×
689
                }
690
        } else if v, ok := interface{}(m.GetChannelHeader()).(interface{ Validate() error }); ok {
×
691
                if err := v.Validate(); err != nil {
×
692
                        return HeaderValidationError{
×
693
                                field:  "ChannelHeader",
×
694
                                reason: "embedded message failed validation",
×
695
                                cause:  err,
×
696
                        }
×
697
                }
×
698
        }
699

700
        if all {
×
701
                switch v := interface{}(m.GetSignatureHeader()).(type) {
×
702
                case interface{ ValidateAll() error }:
×
703
                        if err := v.ValidateAll(); err != nil {
×
704
                                errors = append(errors, HeaderValidationError{
×
705
                                        field:  "SignatureHeader",
×
706
                                        reason: "embedded message failed validation",
×
707
                                        cause:  err,
×
708
                                })
×
709
                        }
×
710
                case interface{ Validate() error }:
×
711
                        if err := v.Validate(); err != nil {
×
712
                                errors = append(errors, HeaderValidationError{
×
713
                                        field:  "SignatureHeader",
×
714
                                        reason: "embedded message failed validation",
×
715
                                        cause:  err,
×
716
                                })
×
717
                        }
×
718
                }
719
        } else if v, ok := interface{}(m.GetSignatureHeader()).(interface{ Validate() error }); ok {
×
720
                if err := v.Validate(); err != nil {
×
721
                        return HeaderValidationError{
×
722
                                field:  "SignatureHeader",
×
723
                                reason: "embedded message failed validation",
×
724
                                cause:  err,
×
725
                        }
×
726
                }
×
727
        }
728

729
        if len(errors) > 0 {
×
730
                return HeaderMultiError(errors)
×
731
        }
×
732

733
        return nil
×
734
}
735

736
// HeaderMultiError is an error wrapping multiple validation errors returned by
737
// Header.ValidateAll() if the designated constraints aren't met.
738
type HeaderMultiError []error
739

740
// Error returns a concatenation of all the error messages it wraps.
741
func (m HeaderMultiError) Error() string {
×
742
        var msgs []string
×
743
        for _, err := range m {
×
744
                msgs = append(msgs, err.Error())
×
745
        }
×
746
        return strings.Join(msgs, "; ")
×
747
}
748

749
// AllErrors returns a list of validation violation errors.
750
func (m HeaderMultiError) AllErrors() []error { return m }
×
751

752
// HeaderValidationError is the validation error returned by Header.Validate if
753
// the designated constraints aren't met.
754
type HeaderValidationError struct {
755
        field  string
756
        reason string
757
        cause  error
758
        key    bool
759
}
760

761
// Field function returns field value.
762
func (e HeaderValidationError) Field() string { return e.field }
×
763

764
// Reason function returns reason value.
765
func (e HeaderValidationError) Reason() string { return e.reason }
×
766

767
// Cause function returns cause value.
768
func (e HeaderValidationError) Cause() error { return e.cause }
×
769

770
// Key function returns key value.
771
func (e HeaderValidationError) Key() bool { return e.key }
×
772

773
// ErrorName returns error name.
774
func (e HeaderValidationError) ErrorName() string { return "HeaderValidationError" }
×
775

776
// Error satisfies the builtin error interface
777
func (e HeaderValidationError) Error() string {
×
778
        cause := ""
×
779
        if e.cause != nil {
×
780
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
781
        }
×
782

783
        key := ""
×
784
        if e.key {
×
785
                key = "key for "
×
786
        }
×
787

788
        return fmt.Sprintf(
×
789
                "invalid %sHeader.%s: %s%s",
×
790
                key,
×
791
                e.field,
×
792
                e.reason,
×
793
                cause)
×
794
}
795

796
var _ error = HeaderValidationError{}
797

798
var _ interface {
799
        Field() string
800
        Reason() string
801
        Key() bool
802
        Cause() error
803
        ErrorName() string
804
} = HeaderValidationError{}
805

806
// Validate checks the field values on SignatureHeader with the rules defined
807
// in the proto definition for this message. If any rules are violated, the
808
// first error encountered is returned, or nil if there are no violations.
809
func (m *SignatureHeader) Validate() error {
×
810
        return m.validate(false)
×
811
}
×
812

813
// ValidateAll checks the field values on SignatureHeader with the rules
814
// defined in the proto definition for this message. If any rules are
815
// violated, the result is a list of violation errors wrapped in
816
// SignatureHeaderMultiError, or nil if none found.
817
func (m *SignatureHeader) ValidateAll() error {
×
818
        return m.validate(true)
×
819
}
×
820

821
func (m *SignatureHeader) validate(all bool) error {
×
822
        if m == nil {
×
823
                return nil
×
824
        }
×
825

826
        var errors []error
×
827

×
828
        if all {
×
829
                switch v := interface{}(m.GetCreator()).(type) {
×
830
                case interface{ ValidateAll() error }:
×
831
                        if err := v.ValidateAll(); err != nil {
×
832
                                errors = append(errors, SignatureHeaderValidationError{
×
833
                                        field:  "Creator",
×
834
                                        reason: "embedded message failed validation",
×
835
                                        cause:  err,
×
836
                                })
×
837
                        }
×
838
                case interface{ Validate() error }:
×
839
                        if err := v.Validate(); err != nil {
×
840
                                errors = append(errors, SignatureHeaderValidationError{
×
841
                                        field:  "Creator",
×
842
                                        reason: "embedded message failed validation",
×
843
                                        cause:  err,
×
844
                                })
×
845
                        }
×
846
                }
847
        } else if v, ok := interface{}(m.GetCreator()).(interface{ Validate() error }); ok {
×
848
                if err := v.Validate(); err != nil {
×
849
                        return SignatureHeaderValidationError{
×
850
                                field:  "Creator",
×
851
                                reason: "embedded message failed validation",
×
852
                                cause:  err,
×
853
                        }
×
854
                }
×
855
        }
856

857
        // no validation rules for Nonce
858

859
        if len(errors) > 0 {
×
860
                return SignatureHeaderMultiError(errors)
×
861
        }
×
862

863
        return nil
×
864
}
865

866
// SignatureHeaderMultiError is an error wrapping multiple validation errors
867
// returned by SignatureHeader.ValidateAll() if the designated constraints
868
// aren't met.
869
type SignatureHeaderMultiError []error
870

871
// Error returns a concatenation of all the error messages it wraps.
872
func (m SignatureHeaderMultiError) Error() string {
×
873
        var msgs []string
×
874
        for _, err := range m {
×
875
                msgs = append(msgs, err.Error())
×
876
        }
×
877
        return strings.Join(msgs, "; ")
×
878
}
879

880
// AllErrors returns a list of validation violation errors.
881
func (m SignatureHeaderMultiError) AllErrors() []error { return m }
×
882

883
// SignatureHeaderValidationError is the validation error returned by
884
// SignatureHeader.Validate if the designated constraints aren't met.
885
type SignatureHeaderValidationError struct {
886
        field  string
887
        reason string
888
        cause  error
889
        key    bool
890
}
891

892
// Field function returns field value.
893
func (e SignatureHeaderValidationError) Field() string { return e.field }
×
894

895
// Reason function returns reason value.
896
func (e SignatureHeaderValidationError) Reason() string { return e.reason }
×
897

898
// Cause function returns cause value.
899
func (e SignatureHeaderValidationError) Cause() error { return e.cause }
×
900

901
// Key function returns key value.
902
func (e SignatureHeaderValidationError) Key() bool { return e.key }
×
903

904
// ErrorName returns error name.
905
func (e SignatureHeaderValidationError) ErrorName() string { return "SignatureHeaderValidationError" }
×
906

907
// Error satisfies the builtin error interface
908
func (e SignatureHeaderValidationError) Error() string {
×
909
        cause := ""
×
910
        if e.cause != nil {
×
911
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
912
        }
×
913

914
        key := ""
×
915
        if e.key {
×
916
                key = "key for "
×
917
        }
×
918

919
        return fmt.Sprintf(
×
920
                "invalid %sSignatureHeader.%s: %s%s",
×
921
                key,
×
922
                e.field,
×
923
                e.reason,
×
924
                cause)
×
925
}
926

927
var _ error = SignatureHeaderValidationError{}
928

929
var _ interface {
930
        Field() string
931
        Reason() string
932
        Key() bool
933
        Cause() error
934
        ErrorName() string
935
} = SignatureHeaderValidationError{}
936

937
// Validate checks the field values on Transaction with the rules defined in
938
// the proto definition for this message. If any rules are violated, the first
939
// error encountered is returned, or nil if there are no violations.
940
func (m *Transaction) Validate() error {
×
941
        return m.validate(false)
×
942
}
×
943

944
// ValidateAll checks the field values on Transaction with the rules defined in
945
// the proto definition for this message. If any rules are violated, the
946
// result is a list of violation errors wrapped in TransactionMultiError, or
947
// nil if none found.
948
func (m *Transaction) ValidateAll() error {
×
949
        return m.validate(true)
×
950
}
×
951

952
func (m *Transaction) validate(all bool) error {
×
953
        if m == nil {
×
954
                return nil
×
955
        }
×
956

957
        var errors []error
×
958

×
959
        if all {
×
960
                switch v := interface{}(m.GetChannelConfig()).(type) {
×
961
                case interface{ ValidateAll() error }:
×
962
                        if err := v.ValidateAll(); err != nil {
×
963
                                errors = append(errors, TransactionValidationError{
×
964
                                        field:  "ChannelConfig",
×
965
                                        reason: "embedded message failed validation",
×
966
                                        cause:  err,
×
967
                                })
×
968
                        }
×
969
                case interface{ Validate() error }:
×
970
                        if err := v.Validate(); err != nil {
×
971
                                errors = append(errors, TransactionValidationError{
×
972
                                        field:  "ChannelConfig",
×
973
                                        reason: "embedded message failed validation",
×
974
                                        cause:  err,
×
975
                                })
×
976
                        }
×
977
                }
978
        } else if v, ok := interface{}(m.GetChannelConfig()).(interface{ Validate() error }); ok {
×
979
                if err := v.Validate(); err != nil {
×
980
                        return TransactionValidationError{
×
981
                                field:  "ChannelConfig",
×
982
                                reason: "embedded message failed validation",
×
983
                                cause:  err,
×
984
                        }
×
985
                }
×
986
        }
987

988
        for idx, item := range m.GetActions() {
×
989
                _, _ = idx, item
×
990

×
991
                if all {
×
992
                        switch v := interface{}(item).(type) {
×
993
                        case interface{ ValidateAll() error }:
×
994
                                if err := v.ValidateAll(); err != nil {
×
995
                                        errors = append(errors, TransactionValidationError{
×
996
                                                field:  fmt.Sprintf("Actions[%v]", idx),
×
997
                                                reason: "embedded message failed validation",
×
998
                                                cause:  err,
×
999
                                        })
×
1000
                                }
×
1001
                        case interface{ Validate() error }:
×
1002
                                if err := v.Validate(); err != nil {
×
1003
                                        errors = append(errors, TransactionValidationError{
×
1004
                                                field:  fmt.Sprintf("Actions[%v]", idx),
×
1005
                                                reason: "embedded message failed validation",
×
1006
                                                cause:  err,
×
1007
                                        })
×
1008
                                }
×
1009
                        }
1010
                } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
×
1011
                        if err := v.Validate(); err != nil {
×
1012
                                return TransactionValidationError{
×
1013
                                        field:  fmt.Sprintf("Actions[%v]", idx),
×
1014
                                        reason: "embedded message failed validation",
×
1015
                                        cause:  err,
×
1016
                                }
×
1017
                        }
×
1018
                }
1019

1020
        }
1021

1022
        if len(errors) > 0 {
×
1023
                return TransactionMultiError(errors)
×
1024
        }
×
1025

1026
        return nil
×
1027
}
1028

1029
// TransactionMultiError is an error wrapping multiple validation errors
1030
// returned by Transaction.ValidateAll() if the designated constraints aren't met.
1031
type TransactionMultiError []error
1032

1033
// Error returns a concatenation of all the error messages it wraps.
1034
func (m TransactionMultiError) Error() string {
×
1035
        var msgs []string
×
1036
        for _, err := range m {
×
1037
                msgs = append(msgs, err.Error())
×
1038
        }
×
1039
        return strings.Join(msgs, "; ")
×
1040
}
1041

1042
// AllErrors returns a list of validation violation errors.
1043
func (m TransactionMultiError) AllErrors() []error { return m }
×
1044

1045
// TransactionValidationError is the validation error returned by
1046
// Transaction.Validate if the designated constraints aren't met.
1047
type TransactionValidationError struct {
1048
        field  string
1049
        reason string
1050
        cause  error
1051
        key    bool
1052
}
1053

1054
// Field function returns field value.
1055
func (e TransactionValidationError) Field() string { return e.field }
×
1056

1057
// Reason function returns reason value.
1058
func (e TransactionValidationError) Reason() string { return e.reason }
×
1059

1060
// Cause function returns cause value.
1061
func (e TransactionValidationError) Cause() error { return e.cause }
×
1062

1063
// Key function returns key value.
1064
func (e TransactionValidationError) Key() bool { return e.key }
×
1065

1066
// ErrorName returns error name.
1067
func (e TransactionValidationError) ErrorName() string { return "TransactionValidationError" }
×
1068

1069
// Error satisfies the builtin error interface
1070
func (e TransactionValidationError) Error() string {
×
1071
        cause := ""
×
1072
        if e.cause != nil {
×
1073
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
1074
        }
×
1075

1076
        key := ""
×
1077
        if e.key {
×
1078
                key = "key for "
×
1079
        }
×
1080

1081
        return fmt.Sprintf(
×
1082
                "invalid %sTransaction.%s: %s%s",
×
1083
                key,
×
1084
                e.field,
×
1085
                e.reason,
×
1086
                cause)
×
1087
}
1088

1089
var _ error = TransactionValidationError{}
1090

1091
var _ interface {
1092
        Field() string
1093
        Reason() string
1094
        Key() bool
1095
        Cause() error
1096
        ErrorName() string
1097
} = TransactionValidationError{}
1098

1099
// Validate checks the field values on TransactionAction with the rules defined
1100
// in the proto definition for this message. If any rules are violated, the
1101
// first error encountered is returned, or nil if there are no violations.
1102
func (m *TransactionAction) Validate() error {
×
1103
        return m.validate(false)
×
1104
}
×
1105

1106
// ValidateAll checks the field values on TransactionAction with the rules
1107
// defined in the proto definition for this message. If any rules are
1108
// violated, the result is a list of violation errors wrapped in
1109
// TransactionActionMultiError, or nil if none found.
1110
func (m *TransactionAction) ValidateAll() error {
×
1111
        return m.validate(true)
×
1112
}
×
1113

1114
func (m *TransactionAction) validate(all bool) error {
×
1115
        if m == nil {
×
1116
                return nil
×
1117
        }
×
1118

1119
        var errors []error
×
1120

×
1121
        if all {
×
1122
                switch v := interface{}(m.GetHeader()).(type) {
×
1123
                case interface{ ValidateAll() error }:
×
1124
                        if err := v.ValidateAll(); err != nil {
×
1125
                                errors = append(errors, TransactionActionValidationError{
×
1126
                                        field:  "Header",
×
1127
                                        reason: "embedded message failed validation",
×
1128
                                        cause:  err,
×
1129
                                })
×
1130
                        }
×
1131
                case interface{ Validate() error }:
×
1132
                        if err := v.Validate(); err != nil {
×
1133
                                errors = append(errors, TransactionActionValidationError{
×
1134
                                        field:  "Header",
×
1135
                                        reason: "embedded message failed validation",
×
1136
                                        cause:  err,
×
1137
                                })
×
1138
                        }
×
1139
                }
1140
        } else if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok {
×
1141
                if err := v.Validate(); err != nil {
×
1142
                        return TransactionActionValidationError{
×
1143
                                field:  "Header",
×
1144
                                reason: "embedded message failed validation",
×
1145
                                cause:  err,
×
1146
                        }
×
1147
                }
×
1148
        }
1149

1150
        if all {
×
1151
                switch v := interface{}(m.GetPayload()).(type) {
×
1152
                case interface{ ValidateAll() error }:
×
1153
                        if err := v.ValidateAll(); err != nil {
×
1154
                                errors = append(errors, TransactionActionValidationError{
×
1155
                                        field:  "Payload",
×
1156
                                        reason: "embedded message failed validation",
×
1157
                                        cause:  err,
×
1158
                                })
×
1159
                        }
×
1160
                case interface{ Validate() error }:
×
1161
                        if err := v.Validate(); err != nil {
×
1162
                                errors = append(errors, TransactionActionValidationError{
×
1163
                                        field:  "Payload",
×
1164
                                        reason: "embedded message failed validation",
×
1165
                                        cause:  err,
×
1166
                                })
×
1167
                        }
×
1168
                }
1169
        } else if v, ok := interface{}(m.GetPayload()).(interface{ Validate() error }); ok {
×
1170
                if err := v.Validate(); err != nil {
×
1171
                        return TransactionActionValidationError{
×
1172
                                field:  "Payload",
×
1173
                                reason: "embedded message failed validation",
×
1174
                                cause:  err,
×
1175
                        }
×
1176
                }
×
1177
        }
1178

1179
        // no validation rules for BytesPayload
1180

1181
        if len(errors) > 0 {
×
1182
                return TransactionActionMultiError(errors)
×
1183
        }
×
1184

1185
        return nil
×
1186
}
1187

1188
// TransactionActionMultiError is an error wrapping multiple validation errors
1189
// returned by TransactionAction.ValidateAll() if the designated constraints
1190
// aren't met.
1191
type TransactionActionMultiError []error
1192

1193
// Error returns a concatenation of all the error messages it wraps.
1194
func (m TransactionActionMultiError) Error() string {
×
1195
        var msgs []string
×
1196
        for _, err := range m {
×
1197
                msgs = append(msgs, err.Error())
×
1198
        }
×
1199
        return strings.Join(msgs, "; ")
×
1200
}
1201

1202
// AllErrors returns a list of validation violation errors.
1203
func (m TransactionActionMultiError) AllErrors() []error { return m }
×
1204

1205
// TransactionActionValidationError is the validation error returned by
1206
// TransactionAction.Validate if the designated constraints aren't met.
1207
type TransactionActionValidationError struct {
1208
        field  string
1209
        reason string
1210
        cause  error
1211
        key    bool
1212
}
1213

1214
// Field function returns field value.
1215
func (e TransactionActionValidationError) Field() string { return e.field }
×
1216

1217
// Reason function returns reason value.
1218
func (e TransactionActionValidationError) Reason() string { return e.reason }
×
1219

1220
// Cause function returns cause value.
1221
func (e TransactionActionValidationError) Cause() error { return e.cause }
×
1222

1223
// Key function returns key value.
1224
func (e TransactionActionValidationError) Key() bool { return e.key }
×
1225

1226
// ErrorName returns error name.
1227
func (e TransactionActionValidationError) ErrorName() string {
×
1228
        return "TransactionActionValidationError"
×
1229
}
×
1230

1231
// Error satisfies the builtin error interface
1232
func (e TransactionActionValidationError) Error() string {
×
1233
        cause := ""
×
1234
        if e.cause != nil {
×
1235
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
1236
        }
×
1237

1238
        key := ""
×
1239
        if e.key {
×
1240
                key = "key for "
×
1241
        }
×
1242

1243
        return fmt.Sprintf(
×
1244
                "invalid %sTransactionAction.%s: %s%s",
×
1245
                key,
×
1246
                e.field,
×
1247
                e.reason,
×
1248
                cause)
×
1249
}
1250

1251
var _ error = TransactionActionValidationError{}
1252

1253
var _ interface {
1254
        Field() string
1255
        Reason() string
1256
        Key() bool
1257
        Cause() error
1258
        ErrorName() string
1259
} = TransactionActionValidationError{}
1260

1261
// Validate checks the field values on ChaincodeActionPayload with the rules
1262
// defined in the proto definition for this message. If any rules are
1263
// violated, the first error encountered is returned, or nil if there are no violations.
1264
func (m *ChaincodeActionPayload) Validate() error {
×
1265
        return m.validate(false)
×
1266
}
×
1267

1268
// ValidateAll checks the field values on ChaincodeActionPayload with the rules
1269
// defined in the proto definition for this message. If any rules are
1270
// violated, the result is a list of violation errors wrapped in
1271
// ChaincodeActionPayloadMultiError, or nil if none found.
1272
func (m *ChaincodeActionPayload) ValidateAll() error {
×
1273
        return m.validate(true)
×
1274
}
×
1275

1276
func (m *ChaincodeActionPayload) validate(all bool) error {
×
1277
        if m == nil {
×
1278
                return nil
×
1279
        }
×
1280

1281
        var errors []error
×
1282

×
1283
        if all {
×
1284
                switch v := interface{}(m.GetChaincodeProposalPayload()).(type) {
×
1285
                case interface{ ValidateAll() error }:
×
1286
                        if err := v.ValidateAll(); err != nil {
×
1287
                                errors = append(errors, ChaincodeActionPayloadValidationError{
×
1288
                                        field:  "ChaincodeProposalPayload",
×
1289
                                        reason: "embedded message failed validation",
×
1290
                                        cause:  err,
×
1291
                                })
×
1292
                        }
×
1293
                case interface{ Validate() error }:
×
1294
                        if err := v.Validate(); err != nil {
×
1295
                                errors = append(errors, ChaincodeActionPayloadValidationError{
×
1296
                                        field:  "ChaincodeProposalPayload",
×
1297
                                        reason: "embedded message failed validation",
×
1298
                                        cause:  err,
×
1299
                                })
×
1300
                        }
×
1301
                }
1302
        } else if v, ok := interface{}(m.GetChaincodeProposalPayload()).(interface{ Validate() error }); ok {
×
1303
                if err := v.Validate(); err != nil {
×
1304
                        return ChaincodeActionPayloadValidationError{
×
1305
                                field:  "ChaincodeProposalPayload",
×
1306
                                reason: "embedded message failed validation",
×
1307
                                cause:  err,
×
1308
                        }
×
1309
                }
×
1310
        }
1311

1312
        if all {
×
1313
                switch v := interface{}(m.GetAction()).(type) {
×
1314
                case interface{ ValidateAll() error }:
×
1315
                        if err := v.ValidateAll(); err != nil {
×
1316
                                errors = append(errors, ChaincodeActionPayloadValidationError{
×
1317
                                        field:  "Action",
×
1318
                                        reason: "embedded message failed validation",
×
1319
                                        cause:  err,
×
1320
                                })
×
1321
                        }
×
1322
                case interface{ Validate() error }:
×
1323
                        if err := v.Validate(); err != nil {
×
1324
                                errors = append(errors, ChaincodeActionPayloadValidationError{
×
1325
                                        field:  "Action",
×
1326
                                        reason: "embedded message failed validation",
×
1327
                                        cause:  err,
×
1328
                                })
×
1329
                        }
×
1330
                }
1331
        } else if v, ok := interface{}(m.GetAction()).(interface{ Validate() error }); ok {
×
1332
                if err := v.Validate(); err != nil {
×
1333
                        return ChaincodeActionPayloadValidationError{
×
1334
                                field:  "Action",
×
1335
                                reason: "embedded message failed validation",
×
1336
                                cause:  err,
×
1337
                        }
×
1338
                }
×
1339
        }
1340

1341
        if len(errors) > 0 {
×
1342
                return ChaincodeActionPayloadMultiError(errors)
×
1343
        }
×
1344

1345
        return nil
×
1346
}
1347

1348
// ChaincodeActionPayloadMultiError is an error wrapping multiple validation
1349
// errors returned by ChaincodeActionPayload.ValidateAll() if the designated
1350
// constraints aren't met.
1351
type ChaincodeActionPayloadMultiError []error
1352

1353
// Error returns a concatenation of all the error messages it wraps.
1354
func (m ChaincodeActionPayloadMultiError) Error() string {
×
1355
        var msgs []string
×
1356
        for _, err := range m {
×
1357
                msgs = append(msgs, err.Error())
×
1358
        }
×
1359
        return strings.Join(msgs, "; ")
×
1360
}
1361

1362
// AllErrors returns a list of validation violation errors.
1363
func (m ChaincodeActionPayloadMultiError) AllErrors() []error { return m }
×
1364

1365
// ChaincodeActionPayloadValidationError is the validation error returned by
1366
// ChaincodeActionPayload.Validate if the designated constraints aren't met.
1367
type ChaincodeActionPayloadValidationError struct {
1368
        field  string
1369
        reason string
1370
        cause  error
1371
        key    bool
1372
}
1373

1374
// Field function returns field value.
1375
func (e ChaincodeActionPayloadValidationError) Field() string { return e.field }
×
1376

1377
// Reason function returns reason value.
1378
func (e ChaincodeActionPayloadValidationError) Reason() string { return e.reason }
×
1379

1380
// Cause function returns cause value.
1381
func (e ChaincodeActionPayloadValidationError) Cause() error { return e.cause }
×
1382

1383
// Key function returns key value.
1384
func (e ChaincodeActionPayloadValidationError) Key() bool { return e.key }
×
1385

1386
// ErrorName returns error name.
1387
func (e ChaincodeActionPayloadValidationError) ErrorName() string {
×
1388
        return "ChaincodeActionPayloadValidationError"
×
1389
}
×
1390

1391
// Error satisfies the builtin error interface
1392
func (e ChaincodeActionPayloadValidationError) Error() string {
×
1393
        cause := ""
×
1394
        if e.cause != nil {
×
1395
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
1396
        }
×
1397

1398
        key := ""
×
1399
        if e.key {
×
1400
                key = "key for "
×
1401
        }
×
1402

1403
        return fmt.Sprintf(
×
1404
                "invalid %sChaincodeActionPayload.%s: %s%s",
×
1405
                key,
×
1406
                e.field,
×
1407
                e.reason,
×
1408
                cause)
×
1409
}
1410

1411
var _ error = ChaincodeActionPayloadValidationError{}
1412

1413
var _ interface {
1414
        Field() string
1415
        Reason() string
1416
        Key() bool
1417
        Cause() error
1418
        ErrorName() string
1419
} = ChaincodeActionPayloadValidationError{}
1420

1421
// Validate checks the field values on ChaincodeProposalPayload with the rules
1422
// defined in the proto definition for this message. If any rules are
1423
// violated, the first error encountered is returned, or nil if there are no violations.
1424
func (m *ChaincodeProposalPayload) Validate() error {
×
1425
        return m.validate(false)
×
1426
}
×
1427

1428
// ValidateAll checks the field values on ChaincodeProposalPayload with the
1429
// rules defined in the proto definition for this message. If any rules are
1430
// violated, the result is a list of violation errors wrapped in
1431
// ChaincodeProposalPayloadMultiError, or nil if none found.
1432
func (m *ChaincodeProposalPayload) ValidateAll() error {
×
1433
        return m.validate(true)
×
1434
}
×
1435

1436
func (m *ChaincodeProposalPayload) validate(all bool) error {
×
1437
        if m == nil {
×
1438
                return nil
×
1439
        }
×
1440

1441
        var errors []error
×
1442

×
1443
        if all {
×
1444
                switch v := interface{}(m.GetInput()).(type) {
×
1445
                case interface{ ValidateAll() error }:
×
1446
                        if err := v.ValidateAll(); err != nil {
×
1447
                                errors = append(errors, ChaincodeProposalPayloadValidationError{
×
1448
                                        field:  "Input",
×
1449
                                        reason: "embedded message failed validation",
×
1450
                                        cause:  err,
×
1451
                                })
×
1452
                        }
×
1453
                case interface{ Validate() error }:
×
1454
                        if err := v.Validate(); err != nil {
×
1455
                                errors = append(errors, ChaincodeProposalPayloadValidationError{
×
1456
                                        field:  "Input",
×
1457
                                        reason: "embedded message failed validation",
×
1458
                                        cause:  err,
×
1459
                                })
×
1460
                        }
×
1461
                }
1462
        } else if v, ok := interface{}(m.GetInput()).(interface{ Validate() error }); ok {
×
1463
                if err := v.Validate(); err != nil {
×
1464
                        return ChaincodeProposalPayloadValidationError{
×
1465
                                field:  "Input",
×
1466
                                reason: "embedded message failed validation",
×
1467
                                cause:  err,
×
1468
                        }
×
1469
                }
×
1470
        }
1471

1472
        // no validation rules for TransientMap
1473

1474
        if len(errors) > 0 {
×
1475
                return ChaincodeProposalPayloadMultiError(errors)
×
1476
        }
×
1477

1478
        return nil
×
1479
}
1480

1481
// ChaincodeProposalPayloadMultiError is an error wrapping multiple validation
1482
// errors returned by ChaincodeProposalPayload.ValidateAll() if the designated
1483
// constraints aren't met.
1484
type ChaincodeProposalPayloadMultiError []error
1485

1486
// Error returns a concatenation of all the error messages it wraps.
1487
func (m ChaincodeProposalPayloadMultiError) Error() string {
×
1488
        var msgs []string
×
1489
        for _, err := range m {
×
1490
                msgs = append(msgs, err.Error())
×
1491
        }
×
1492
        return strings.Join(msgs, "; ")
×
1493
}
1494

1495
// AllErrors returns a list of validation violation errors.
1496
func (m ChaincodeProposalPayloadMultiError) AllErrors() []error { return m }
×
1497

1498
// ChaincodeProposalPayloadValidationError is the validation error returned by
1499
// ChaincodeProposalPayload.Validate if the designated constraints aren't met.
1500
type ChaincodeProposalPayloadValidationError struct {
1501
        field  string
1502
        reason string
1503
        cause  error
1504
        key    bool
1505
}
1506

1507
// Field function returns field value.
1508
func (e ChaincodeProposalPayloadValidationError) Field() string { return e.field }
×
1509

1510
// Reason function returns reason value.
1511
func (e ChaincodeProposalPayloadValidationError) Reason() string { return e.reason }
×
1512

1513
// Cause function returns cause value.
1514
func (e ChaincodeProposalPayloadValidationError) Cause() error { return e.cause }
×
1515

1516
// Key function returns key value.
1517
func (e ChaincodeProposalPayloadValidationError) Key() bool { return e.key }
×
1518

1519
// ErrorName returns error name.
1520
func (e ChaincodeProposalPayloadValidationError) ErrorName() string {
×
1521
        return "ChaincodeProposalPayloadValidationError"
×
1522
}
×
1523

1524
// Error satisfies the builtin error interface
1525
func (e ChaincodeProposalPayloadValidationError) Error() string {
×
1526
        cause := ""
×
1527
        if e.cause != nil {
×
1528
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
1529
        }
×
1530

1531
        key := ""
×
1532
        if e.key {
×
1533
                key = "key for "
×
1534
        }
×
1535

1536
        return fmt.Sprintf(
×
1537
                "invalid %sChaincodeProposalPayload.%s: %s%s",
×
1538
                key,
×
1539
                e.field,
×
1540
                e.reason,
×
1541
                cause)
×
1542
}
1543

1544
var _ error = ChaincodeProposalPayloadValidationError{}
1545

1546
var _ interface {
1547
        Field() string
1548
        Reason() string
1549
        Key() bool
1550
        Cause() error
1551
        ErrorName() string
1552
} = ChaincodeProposalPayloadValidationError{}
1553

1554
// Validate checks the field values on ChaincodeEndorsedAction with the rules
1555
// defined in the proto definition for this message. If any rules are
1556
// violated, the first error encountered is returned, or nil if there are no violations.
1557
func (m *ChaincodeEndorsedAction) Validate() error {
×
1558
        return m.validate(false)
×
1559
}
×
1560

1561
// ValidateAll checks the field values on ChaincodeEndorsedAction with the
1562
// rules defined in the proto definition for this message. If any rules are
1563
// violated, the result is a list of violation errors wrapped in
1564
// ChaincodeEndorsedActionMultiError, or nil if none found.
1565
func (m *ChaincodeEndorsedAction) ValidateAll() error {
×
1566
        return m.validate(true)
×
1567
}
×
1568

1569
func (m *ChaincodeEndorsedAction) validate(all bool) error {
×
1570
        if m == nil {
×
1571
                return nil
×
1572
        }
×
1573

1574
        var errors []error
×
1575

×
1576
        if all {
×
1577
                switch v := interface{}(m.GetProposalResponsePayload()).(type) {
×
1578
                case interface{ ValidateAll() error }:
×
1579
                        if err := v.ValidateAll(); err != nil {
×
1580
                                errors = append(errors, ChaincodeEndorsedActionValidationError{
×
1581
                                        field:  "ProposalResponsePayload",
×
1582
                                        reason: "embedded message failed validation",
×
1583
                                        cause:  err,
×
1584
                                })
×
1585
                        }
×
1586
                case interface{ Validate() error }:
×
1587
                        if err := v.Validate(); err != nil {
×
1588
                                errors = append(errors, ChaincodeEndorsedActionValidationError{
×
1589
                                        field:  "ProposalResponsePayload",
×
1590
                                        reason: "embedded message failed validation",
×
1591
                                        cause:  err,
×
1592
                                })
×
1593
                        }
×
1594
                }
1595
        } else if v, ok := interface{}(m.GetProposalResponsePayload()).(interface{ Validate() error }); ok {
×
1596
                if err := v.Validate(); err != nil {
×
1597
                        return ChaincodeEndorsedActionValidationError{
×
1598
                                field:  "ProposalResponsePayload",
×
1599
                                reason: "embedded message failed validation",
×
1600
                                cause:  err,
×
1601
                        }
×
1602
                }
×
1603
        }
1604

1605
        for idx, item := range m.GetEndorsement() {
×
1606
                _, _ = idx, item
×
1607

×
1608
                if all {
×
1609
                        switch v := interface{}(item).(type) {
×
1610
                        case interface{ ValidateAll() error }:
×
1611
                                if err := v.ValidateAll(); err != nil {
×
1612
                                        errors = append(errors, ChaincodeEndorsedActionValidationError{
×
1613
                                                field:  fmt.Sprintf("Endorsement[%v]", idx),
×
1614
                                                reason: "embedded message failed validation",
×
1615
                                                cause:  err,
×
1616
                                        })
×
1617
                                }
×
1618
                        case interface{ Validate() error }:
×
1619
                                if err := v.Validate(); err != nil {
×
1620
                                        errors = append(errors, ChaincodeEndorsedActionValidationError{
×
1621
                                                field:  fmt.Sprintf("Endorsement[%v]", idx),
×
1622
                                                reason: "embedded message failed validation",
×
1623
                                                cause:  err,
×
1624
                                        })
×
1625
                                }
×
1626
                        }
1627
                } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
×
1628
                        if err := v.Validate(); err != nil {
×
1629
                                return ChaincodeEndorsedActionValidationError{
×
1630
                                        field:  fmt.Sprintf("Endorsement[%v]", idx),
×
1631
                                        reason: "embedded message failed validation",
×
1632
                                        cause:  err,
×
1633
                                }
×
1634
                        }
×
1635
                }
1636

1637
        }
1638

1639
        if len(errors) > 0 {
×
1640
                return ChaincodeEndorsedActionMultiError(errors)
×
1641
        }
×
1642

1643
        return nil
×
1644
}
1645

1646
// ChaincodeEndorsedActionMultiError is an error wrapping multiple validation
1647
// errors returned by ChaincodeEndorsedAction.ValidateAll() if the designated
1648
// constraints aren't met.
1649
type ChaincodeEndorsedActionMultiError []error
1650

1651
// Error returns a concatenation of all the error messages it wraps.
1652
func (m ChaincodeEndorsedActionMultiError) Error() string {
×
1653
        var msgs []string
×
1654
        for _, err := range m {
×
1655
                msgs = append(msgs, err.Error())
×
1656
        }
×
1657
        return strings.Join(msgs, "; ")
×
1658
}
1659

1660
// AllErrors returns a list of validation violation errors.
1661
func (m ChaincodeEndorsedActionMultiError) AllErrors() []error { return m }
×
1662

1663
// ChaincodeEndorsedActionValidationError is the validation error returned by
1664
// ChaincodeEndorsedAction.Validate if the designated constraints aren't met.
1665
type ChaincodeEndorsedActionValidationError struct {
1666
        field  string
1667
        reason string
1668
        cause  error
1669
        key    bool
1670
}
1671

1672
// Field function returns field value.
1673
func (e ChaincodeEndorsedActionValidationError) Field() string { return e.field }
×
1674

1675
// Reason function returns reason value.
1676
func (e ChaincodeEndorsedActionValidationError) Reason() string { return e.reason }
×
1677

1678
// Cause function returns cause value.
1679
func (e ChaincodeEndorsedActionValidationError) Cause() error { return e.cause }
×
1680

1681
// Key function returns key value.
1682
func (e ChaincodeEndorsedActionValidationError) Key() bool { return e.key }
×
1683

1684
// ErrorName returns error name.
1685
func (e ChaincodeEndorsedActionValidationError) ErrorName() string {
×
1686
        return "ChaincodeEndorsedActionValidationError"
×
1687
}
×
1688

1689
// Error satisfies the builtin error interface
1690
func (e ChaincodeEndorsedActionValidationError) Error() string {
×
1691
        cause := ""
×
1692
        if e.cause != nil {
×
1693
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
1694
        }
×
1695

1696
        key := ""
×
1697
        if e.key {
×
1698
                key = "key for "
×
1699
        }
×
1700

1701
        return fmt.Sprintf(
×
1702
                "invalid %sChaincodeEndorsedAction.%s: %s%s",
×
1703
                key,
×
1704
                e.field,
×
1705
                e.reason,
×
1706
                cause)
×
1707
}
1708

1709
var _ error = ChaincodeEndorsedActionValidationError{}
1710

1711
var _ interface {
1712
        Field() string
1713
        Reason() string
1714
        Key() bool
1715
        Cause() error
1716
        ErrorName() string
1717
} = ChaincodeEndorsedActionValidationError{}
1718

1719
// Validate checks the field values on ProposalResponsePayload with the rules
1720
// defined in the proto definition for this message. If any rules are
1721
// violated, the first error encountered is returned, or nil if there are no violations.
1722
func (m *ProposalResponsePayload) Validate() error {
×
1723
        return m.validate(false)
×
1724
}
×
1725

1726
// ValidateAll checks the field values on ProposalResponsePayload with the
1727
// rules defined in the proto definition for this message. If any rules are
1728
// violated, the result is a list of violation errors wrapped in
1729
// ProposalResponsePayloadMultiError, or nil if none found.
1730
func (m *ProposalResponsePayload) ValidateAll() error {
×
1731
        return m.validate(true)
×
1732
}
×
1733

1734
func (m *ProposalResponsePayload) validate(all bool) error {
×
1735
        if m == nil {
×
1736
                return nil
×
1737
        }
×
1738

1739
        var errors []error
×
1740

×
1741
        // no validation rules for ProposalHash
×
1742

×
1743
        if all {
×
1744
                switch v := interface{}(m.GetExtension()).(type) {
×
1745
                case interface{ ValidateAll() error }:
×
1746
                        if err := v.ValidateAll(); err != nil {
×
1747
                                errors = append(errors, ProposalResponsePayloadValidationError{
×
1748
                                        field:  "Extension",
×
1749
                                        reason: "embedded message failed validation",
×
1750
                                        cause:  err,
×
1751
                                })
×
1752
                        }
×
1753
                case interface{ Validate() error }:
×
1754
                        if err := v.Validate(); err != nil {
×
1755
                                errors = append(errors, ProposalResponsePayloadValidationError{
×
1756
                                        field:  "Extension",
×
1757
                                        reason: "embedded message failed validation",
×
1758
                                        cause:  err,
×
1759
                                })
×
1760
                        }
×
1761
                }
1762
        } else if v, ok := interface{}(m.GetExtension()).(interface{ Validate() error }); ok {
×
1763
                if err := v.Validate(); err != nil {
×
1764
                        return ProposalResponsePayloadValidationError{
×
1765
                                field:  "Extension",
×
1766
                                reason: "embedded message failed validation",
×
1767
                                cause:  err,
×
1768
                        }
×
1769
                }
×
1770
        }
1771

1772
        if len(errors) > 0 {
×
1773
                return ProposalResponsePayloadMultiError(errors)
×
1774
        }
×
1775

1776
        return nil
×
1777
}
1778

1779
// ProposalResponsePayloadMultiError is an error wrapping multiple validation
1780
// errors returned by ProposalResponsePayload.ValidateAll() if the designated
1781
// constraints aren't met.
1782
type ProposalResponsePayloadMultiError []error
1783

1784
// Error returns a concatenation of all the error messages it wraps.
1785
func (m ProposalResponsePayloadMultiError) Error() string {
×
1786
        var msgs []string
×
1787
        for _, err := range m {
×
1788
                msgs = append(msgs, err.Error())
×
1789
        }
×
1790
        return strings.Join(msgs, "; ")
×
1791
}
1792

1793
// AllErrors returns a list of validation violation errors.
1794
func (m ProposalResponsePayloadMultiError) AllErrors() []error { return m }
×
1795

1796
// ProposalResponsePayloadValidationError is the validation error returned by
1797
// ProposalResponsePayload.Validate if the designated constraints aren't met.
1798
type ProposalResponsePayloadValidationError struct {
1799
        field  string
1800
        reason string
1801
        cause  error
1802
        key    bool
1803
}
1804

1805
// Field function returns field value.
1806
func (e ProposalResponsePayloadValidationError) Field() string { return e.field }
×
1807

1808
// Reason function returns reason value.
1809
func (e ProposalResponsePayloadValidationError) Reason() string { return e.reason }
×
1810

1811
// Cause function returns cause value.
1812
func (e ProposalResponsePayloadValidationError) Cause() error { return e.cause }
×
1813

1814
// Key function returns key value.
1815
func (e ProposalResponsePayloadValidationError) Key() bool { return e.key }
×
1816

1817
// ErrorName returns error name.
1818
func (e ProposalResponsePayloadValidationError) ErrorName() string {
×
1819
        return "ProposalResponsePayloadValidationError"
×
1820
}
×
1821

1822
// Error satisfies the builtin error interface
1823
func (e ProposalResponsePayloadValidationError) Error() string {
×
1824
        cause := ""
×
1825
        if e.cause != nil {
×
1826
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
1827
        }
×
1828

1829
        key := ""
×
1830
        if e.key {
×
1831
                key = "key for "
×
1832
        }
×
1833

1834
        return fmt.Sprintf(
×
1835
                "invalid %sProposalResponsePayload.%s: %s%s",
×
1836
                key,
×
1837
                e.field,
×
1838
                e.reason,
×
1839
                cause)
×
1840
}
1841

1842
var _ error = ProposalResponsePayloadValidationError{}
1843

1844
var _ interface {
1845
        Field() string
1846
        Reason() string
1847
        Key() bool
1848
        Cause() error
1849
        ErrorName() string
1850
} = ProposalResponsePayloadValidationError{}
1851

1852
// Validate checks the field values on ChaincodeAction with the rules defined
1853
// in the proto definition for this message. If any rules are violated, the
1854
// first error encountered is returned, or nil if there are no violations.
1855
func (m *ChaincodeAction) Validate() error {
×
1856
        return m.validate(false)
×
1857
}
×
1858

1859
// ValidateAll checks the field values on ChaincodeAction with the rules
1860
// defined in the proto definition for this message. If any rules are
1861
// violated, the result is a list of violation errors wrapped in
1862
// ChaincodeActionMultiError, or nil if none found.
1863
func (m *ChaincodeAction) ValidateAll() error {
×
1864
        return m.validate(true)
×
1865
}
×
1866

1867
func (m *ChaincodeAction) validate(all bool) error {
×
1868
        if m == nil {
×
1869
                return nil
×
1870
        }
×
1871

1872
        var errors []error
×
1873

×
1874
        if all {
×
1875
                switch v := interface{}(m.GetResults()).(type) {
×
1876
                case interface{ ValidateAll() error }:
×
1877
                        if err := v.ValidateAll(); err != nil {
×
1878
                                errors = append(errors, ChaincodeActionValidationError{
×
1879
                                        field:  "Results",
×
1880
                                        reason: "embedded message failed validation",
×
1881
                                        cause:  err,
×
1882
                                })
×
1883
                        }
×
1884
                case interface{ Validate() error }:
×
1885
                        if err := v.Validate(); err != nil {
×
1886
                                errors = append(errors, ChaincodeActionValidationError{
×
1887
                                        field:  "Results",
×
1888
                                        reason: "embedded message failed validation",
×
1889
                                        cause:  err,
×
1890
                                })
×
1891
                        }
×
1892
                }
1893
        } else if v, ok := interface{}(m.GetResults()).(interface{ Validate() error }); ok {
×
1894
                if err := v.Validate(); err != nil {
×
1895
                        return ChaincodeActionValidationError{
×
1896
                                field:  "Results",
×
1897
                                reason: "embedded message failed validation",
×
1898
                                cause:  err,
×
1899
                        }
×
1900
                }
×
1901
        }
1902

1903
        if all {
×
1904
                switch v := interface{}(m.GetEvents()).(type) {
×
1905
                case interface{ ValidateAll() error }:
×
1906
                        if err := v.ValidateAll(); err != nil {
×
1907
                                errors = append(errors, ChaincodeActionValidationError{
×
1908
                                        field:  "Events",
×
1909
                                        reason: "embedded message failed validation",
×
1910
                                        cause:  err,
×
1911
                                })
×
1912
                        }
×
1913
                case interface{ Validate() error }:
×
1914
                        if err := v.Validate(); err != nil {
×
1915
                                errors = append(errors, ChaincodeActionValidationError{
×
1916
                                        field:  "Events",
×
1917
                                        reason: "embedded message failed validation",
×
1918
                                        cause:  err,
×
1919
                                })
×
1920
                        }
×
1921
                }
1922
        } else if v, ok := interface{}(m.GetEvents()).(interface{ Validate() error }); ok {
×
1923
                if err := v.Validate(); err != nil {
×
1924
                        return ChaincodeActionValidationError{
×
1925
                                field:  "Events",
×
1926
                                reason: "embedded message failed validation",
×
1927
                                cause:  err,
×
1928
                        }
×
1929
                }
×
1930
        }
1931

1932
        if all {
×
1933
                switch v := interface{}(m.GetResponse()).(type) {
×
1934
                case interface{ ValidateAll() error }:
×
1935
                        if err := v.ValidateAll(); err != nil {
×
1936
                                errors = append(errors, ChaincodeActionValidationError{
×
1937
                                        field:  "Response",
×
1938
                                        reason: "embedded message failed validation",
×
1939
                                        cause:  err,
×
1940
                                })
×
1941
                        }
×
1942
                case interface{ Validate() error }:
×
1943
                        if err := v.Validate(); err != nil {
×
1944
                                errors = append(errors, ChaincodeActionValidationError{
×
1945
                                        field:  "Response",
×
1946
                                        reason: "embedded message failed validation",
×
1947
                                        cause:  err,
×
1948
                                })
×
1949
                        }
×
1950
                }
1951
        } else if v, ok := interface{}(m.GetResponse()).(interface{ Validate() error }); ok {
×
1952
                if err := v.Validate(); err != nil {
×
1953
                        return ChaincodeActionValidationError{
×
1954
                                field:  "Response",
×
1955
                                reason: "embedded message failed validation",
×
1956
                                cause:  err,
×
1957
                        }
×
1958
                }
×
1959
        }
1960

1961
        if all {
×
1962
                switch v := interface{}(m.GetChaincodeId()).(type) {
×
1963
                case interface{ ValidateAll() error }:
×
1964
                        if err := v.ValidateAll(); err != nil {
×
1965
                                errors = append(errors, ChaincodeActionValidationError{
×
1966
                                        field:  "ChaincodeId",
×
1967
                                        reason: "embedded message failed validation",
×
1968
                                        cause:  err,
×
1969
                                })
×
1970
                        }
×
1971
                case interface{ Validate() error }:
×
1972
                        if err := v.Validate(); err != nil {
×
1973
                                errors = append(errors, ChaincodeActionValidationError{
×
1974
                                        field:  "ChaincodeId",
×
1975
                                        reason: "embedded message failed validation",
×
1976
                                        cause:  err,
×
1977
                                })
×
1978
                        }
×
1979
                }
1980
        } else if v, ok := interface{}(m.GetChaincodeId()).(interface{ Validate() error }); ok {
×
1981
                if err := v.Validate(); err != nil {
×
1982
                        return ChaincodeActionValidationError{
×
1983
                                field:  "ChaincodeId",
×
1984
                                reason: "embedded message failed validation",
×
1985
                                cause:  err,
×
1986
                        }
×
1987
                }
×
1988
        }
1989

1990
        if len(errors) > 0 {
×
1991
                return ChaincodeActionMultiError(errors)
×
1992
        }
×
1993

1994
        return nil
×
1995
}
1996

1997
// ChaincodeActionMultiError is an error wrapping multiple validation errors
1998
// returned by ChaincodeAction.ValidateAll() if the designated constraints
1999
// aren't met.
2000
type ChaincodeActionMultiError []error
2001

2002
// Error returns a concatenation of all the error messages it wraps.
2003
func (m ChaincodeActionMultiError) Error() string {
×
2004
        var msgs []string
×
2005
        for _, err := range m {
×
2006
                msgs = append(msgs, err.Error())
×
2007
        }
×
2008
        return strings.Join(msgs, "; ")
×
2009
}
2010

2011
// AllErrors returns a list of validation violation errors.
2012
func (m ChaincodeActionMultiError) AllErrors() []error { return m }
×
2013

2014
// ChaincodeActionValidationError is the validation error returned by
2015
// ChaincodeAction.Validate if the designated constraints aren't met.
2016
type ChaincodeActionValidationError struct {
2017
        field  string
2018
        reason string
2019
        cause  error
2020
        key    bool
2021
}
2022

2023
// Field function returns field value.
2024
func (e ChaincodeActionValidationError) Field() string { return e.field }
×
2025

2026
// Reason function returns reason value.
2027
func (e ChaincodeActionValidationError) Reason() string { return e.reason }
×
2028

2029
// Cause function returns cause value.
2030
func (e ChaincodeActionValidationError) Cause() error { return e.cause }
×
2031

2032
// Key function returns key value.
2033
func (e ChaincodeActionValidationError) Key() bool { return e.key }
×
2034

2035
// ErrorName returns error name.
2036
func (e ChaincodeActionValidationError) ErrorName() string { return "ChaincodeActionValidationError" }
×
2037

2038
// Error satisfies the builtin error interface
2039
func (e ChaincodeActionValidationError) Error() string {
×
2040
        cause := ""
×
2041
        if e.cause != nil {
×
2042
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
2043
        }
×
2044

2045
        key := ""
×
2046
        if e.key {
×
2047
                key = "key for "
×
2048
        }
×
2049

2050
        return fmt.Sprintf(
×
2051
                "invalid %sChaincodeAction.%s: %s%s",
×
2052
                key,
×
2053
                e.field,
×
2054
                e.reason,
×
2055
                cause)
×
2056
}
2057

2058
var _ error = ChaincodeActionValidationError{}
2059

2060
var _ interface {
2061
        Field() string
2062
        Reason() string
2063
        Key() bool
2064
        Cause() error
2065
        ErrorName() string
2066
} = ChaincodeActionValidationError{}
2067

2068
// Validate checks the field values on TxReadWriteSet with the rules defined in
2069
// the proto definition for this message. If any rules are violated, the first
2070
// error encountered is returned, or nil if there are no violations.
2071
func (m *TxReadWriteSet) Validate() error {
×
2072
        return m.validate(false)
×
2073
}
×
2074

2075
// ValidateAll checks the field values on TxReadWriteSet with the rules defined
2076
// in the proto definition for this message. If any rules are violated, the
2077
// result is a list of violation errors wrapped in TxReadWriteSetMultiError,
2078
// or nil if none found.
2079
func (m *TxReadWriteSet) ValidateAll() error {
×
2080
        return m.validate(true)
×
2081
}
×
2082

2083
func (m *TxReadWriteSet) validate(all bool) error {
×
2084
        if m == nil {
×
2085
                return nil
×
2086
        }
×
2087

2088
        var errors []error
×
2089

×
2090
        // no validation rules for DataModel
×
2091

×
2092
        for idx, item := range m.GetNsRwset() {
×
2093
                _, _ = idx, item
×
2094

×
2095
                if all {
×
2096
                        switch v := interface{}(item).(type) {
×
2097
                        case interface{ ValidateAll() error }:
×
2098
                                if err := v.ValidateAll(); err != nil {
×
2099
                                        errors = append(errors, TxReadWriteSetValidationError{
×
2100
                                                field:  fmt.Sprintf("NsRwset[%v]", idx),
×
2101
                                                reason: "embedded message failed validation",
×
2102
                                                cause:  err,
×
2103
                                        })
×
2104
                                }
×
2105
                        case interface{ Validate() error }:
×
2106
                                if err := v.Validate(); err != nil {
×
2107
                                        errors = append(errors, TxReadWriteSetValidationError{
×
2108
                                                field:  fmt.Sprintf("NsRwset[%v]", idx),
×
2109
                                                reason: "embedded message failed validation",
×
2110
                                                cause:  err,
×
2111
                                        })
×
2112
                                }
×
2113
                        }
2114
                } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
×
2115
                        if err := v.Validate(); err != nil {
×
2116
                                return TxReadWriteSetValidationError{
×
2117
                                        field:  fmt.Sprintf("NsRwset[%v]", idx),
×
2118
                                        reason: "embedded message failed validation",
×
2119
                                        cause:  err,
×
2120
                                }
×
2121
                        }
×
2122
                }
2123

2124
        }
2125

2126
        if len(errors) > 0 {
×
2127
                return TxReadWriteSetMultiError(errors)
×
2128
        }
×
2129

2130
        return nil
×
2131
}
2132

2133
// TxReadWriteSetMultiError is an error wrapping multiple validation errors
2134
// returned by TxReadWriteSet.ValidateAll() if the designated constraints
2135
// aren't met.
2136
type TxReadWriteSetMultiError []error
2137

2138
// Error returns a concatenation of all the error messages it wraps.
2139
func (m TxReadWriteSetMultiError) Error() string {
×
2140
        var msgs []string
×
2141
        for _, err := range m {
×
2142
                msgs = append(msgs, err.Error())
×
2143
        }
×
2144
        return strings.Join(msgs, "; ")
×
2145
}
2146

2147
// AllErrors returns a list of validation violation errors.
2148
func (m TxReadWriteSetMultiError) AllErrors() []error { return m }
×
2149

2150
// TxReadWriteSetValidationError is the validation error returned by
2151
// TxReadWriteSet.Validate if the designated constraints aren't met.
2152
type TxReadWriteSetValidationError struct {
2153
        field  string
2154
        reason string
2155
        cause  error
2156
        key    bool
2157
}
2158

2159
// Field function returns field value.
2160
func (e TxReadWriteSetValidationError) Field() string { return e.field }
×
2161

2162
// Reason function returns reason value.
2163
func (e TxReadWriteSetValidationError) Reason() string { return e.reason }
×
2164

2165
// Cause function returns cause value.
2166
func (e TxReadWriteSetValidationError) Cause() error { return e.cause }
×
2167

2168
// Key function returns key value.
2169
func (e TxReadWriteSetValidationError) Key() bool { return e.key }
×
2170

2171
// ErrorName returns error name.
2172
func (e TxReadWriteSetValidationError) ErrorName() string { return "TxReadWriteSetValidationError" }
×
2173

2174
// Error satisfies the builtin error interface
2175
func (e TxReadWriteSetValidationError) Error() string {
×
2176
        cause := ""
×
2177
        if e.cause != nil {
×
2178
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
2179
        }
×
2180

2181
        key := ""
×
2182
        if e.key {
×
2183
                key = "key for "
×
2184
        }
×
2185

2186
        return fmt.Sprintf(
×
2187
                "invalid %sTxReadWriteSet.%s: %s%s",
×
2188
                key,
×
2189
                e.field,
×
2190
                e.reason,
×
2191
                cause)
×
2192
}
2193

2194
var _ error = TxReadWriteSetValidationError{}
2195

2196
var _ interface {
2197
        Field() string
2198
        Reason() string
2199
        Key() bool
2200
        Cause() error
2201
        ErrorName() string
2202
} = TxReadWriteSetValidationError{}
2203

2204
// Validate checks the field values on NsReadWriteSet with the rules defined in
2205
// the proto definition for this message. If any rules are violated, the first
2206
// error encountered is returned, or nil if there are no violations.
2207
func (m *NsReadWriteSet) Validate() error {
×
2208
        return m.validate(false)
×
2209
}
×
2210

2211
// ValidateAll checks the field values on NsReadWriteSet with the rules defined
2212
// in the proto definition for this message. If any rules are violated, the
2213
// result is a list of violation errors wrapped in NsReadWriteSetMultiError,
2214
// or nil if none found.
2215
func (m *NsReadWriteSet) ValidateAll() error {
×
2216
        return m.validate(true)
×
2217
}
×
2218

2219
func (m *NsReadWriteSet) validate(all bool) error {
×
2220
        if m == nil {
×
2221
                return nil
×
2222
        }
×
2223

2224
        var errors []error
×
2225

×
2226
        // no validation rules for Namespace
×
2227

×
2228
        if all {
×
2229
                switch v := interface{}(m.GetRwset()).(type) {
×
2230
                case interface{ ValidateAll() error }:
×
2231
                        if err := v.ValidateAll(); err != nil {
×
2232
                                errors = append(errors, NsReadWriteSetValidationError{
×
2233
                                        field:  "Rwset",
×
2234
                                        reason: "embedded message failed validation",
×
2235
                                        cause:  err,
×
2236
                                })
×
2237
                        }
×
2238
                case interface{ Validate() error }:
×
2239
                        if err := v.Validate(); err != nil {
×
2240
                                errors = append(errors, NsReadWriteSetValidationError{
×
2241
                                        field:  "Rwset",
×
2242
                                        reason: "embedded message failed validation",
×
2243
                                        cause:  err,
×
2244
                                })
×
2245
                        }
×
2246
                }
2247
        } else if v, ok := interface{}(m.GetRwset()).(interface{ Validate() error }); ok {
×
2248
                if err := v.Validate(); err != nil {
×
2249
                        return NsReadWriteSetValidationError{
×
2250
                                field:  "Rwset",
×
2251
                                reason: "embedded message failed validation",
×
2252
                                cause:  err,
×
2253
                        }
×
2254
                }
×
2255
        }
2256

2257
        for idx, item := range m.GetCollectionHashedRwset() {
×
2258
                _, _ = idx, item
×
2259

×
2260
                if all {
×
2261
                        switch v := interface{}(item).(type) {
×
2262
                        case interface{ ValidateAll() error }:
×
2263
                                if err := v.ValidateAll(); err != nil {
×
2264
                                        errors = append(errors, NsReadWriteSetValidationError{
×
2265
                                                field:  fmt.Sprintf("CollectionHashedRwset[%v]", idx),
×
2266
                                                reason: "embedded message failed validation",
×
2267
                                                cause:  err,
×
2268
                                        })
×
2269
                                }
×
2270
                        case interface{ Validate() error }:
×
2271
                                if err := v.Validate(); err != nil {
×
2272
                                        errors = append(errors, NsReadWriteSetValidationError{
×
2273
                                                field:  fmt.Sprintf("CollectionHashedRwset[%v]", idx),
×
2274
                                                reason: "embedded message failed validation",
×
2275
                                                cause:  err,
×
2276
                                        })
×
2277
                                }
×
2278
                        }
2279
                } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
×
2280
                        if err := v.Validate(); err != nil {
×
2281
                                return NsReadWriteSetValidationError{
×
2282
                                        field:  fmt.Sprintf("CollectionHashedRwset[%v]", idx),
×
2283
                                        reason: "embedded message failed validation",
×
2284
                                        cause:  err,
×
2285
                                }
×
2286
                        }
×
2287
                }
2288

2289
        }
2290

2291
        if len(errors) > 0 {
×
2292
                return NsReadWriteSetMultiError(errors)
×
2293
        }
×
2294

2295
        return nil
×
2296
}
2297

2298
// NsReadWriteSetMultiError is an error wrapping multiple validation errors
2299
// returned by NsReadWriteSet.ValidateAll() if the designated constraints
2300
// aren't met.
2301
type NsReadWriteSetMultiError []error
2302

2303
// Error returns a concatenation of all the error messages it wraps.
2304
func (m NsReadWriteSetMultiError) Error() string {
×
2305
        var msgs []string
×
2306
        for _, err := range m {
×
2307
                msgs = append(msgs, err.Error())
×
2308
        }
×
2309
        return strings.Join(msgs, "; ")
×
2310
}
2311

2312
// AllErrors returns a list of validation violation errors.
2313
func (m NsReadWriteSetMultiError) AllErrors() []error { return m }
×
2314

2315
// NsReadWriteSetValidationError is the validation error returned by
2316
// NsReadWriteSet.Validate if the designated constraints aren't met.
2317
type NsReadWriteSetValidationError struct {
2318
        field  string
2319
        reason string
2320
        cause  error
2321
        key    bool
2322
}
2323

2324
// Field function returns field value.
2325
func (e NsReadWriteSetValidationError) Field() string { return e.field }
×
2326

2327
// Reason function returns reason value.
2328
func (e NsReadWriteSetValidationError) Reason() string { return e.reason }
×
2329

2330
// Cause function returns cause value.
2331
func (e NsReadWriteSetValidationError) Cause() error { return e.cause }
×
2332

2333
// Key function returns key value.
2334
func (e NsReadWriteSetValidationError) Key() bool { return e.key }
×
2335

2336
// ErrorName returns error name.
2337
func (e NsReadWriteSetValidationError) ErrorName() string { return "NsReadWriteSetValidationError" }
×
2338

2339
// Error satisfies the builtin error interface
2340
func (e NsReadWriteSetValidationError) Error() string {
×
2341
        cause := ""
×
2342
        if e.cause != nil {
×
2343
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
2344
        }
×
2345

2346
        key := ""
×
2347
        if e.key {
×
2348
                key = "key for "
×
2349
        }
×
2350

2351
        return fmt.Sprintf(
×
2352
                "invalid %sNsReadWriteSet.%s: %s%s",
×
2353
                key,
×
2354
                e.field,
×
2355
                e.reason,
×
2356
                cause)
×
2357
}
2358

2359
var _ error = NsReadWriteSetValidationError{}
2360

2361
var _ interface {
2362
        Field() string
2363
        Reason() string
2364
        Key() bool
2365
        Cause() error
2366
        ErrorName() string
2367
} = NsReadWriteSetValidationError{}
2368

2369
// Validate checks the field values on CollectionHashedReadWriteSet with the
2370
// rules defined in the proto definition for this message. If any rules are
2371
// violated, the first error encountered is returned, or nil if there are no violations.
2372
func (m *CollectionHashedReadWriteSet) Validate() error {
×
2373
        return m.validate(false)
×
2374
}
×
2375

2376
// ValidateAll checks the field values on CollectionHashedReadWriteSet with the
2377
// rules defined in the proto definition for this message. If any rules are
2378
// violated, the result is a list of violation errors wrapped in
2379
// CollectionHashedReadWriteSetMultiError, or nil if none found.
2380
func (m *CollectionHashedReadWriteSet) ValidateAll() error {
×
2381
        return m.validate(true)
×
2382
}
×
2383

2384
func (m *CollectionHashedReadWriteSet) validate(all bool) error {
×
2385
        if m == nil {
×
2386
                return nil
×
2387
        }
×
2388

2389
        var errors []error
×
2390

×
2391
        // no validation rules for CollectionName
×
2392

×
2393
        if all {
×
2394
                switch v := interface{}(m.GetHashedRwset()).(type) {
×
2395
                case interface{ ValidateAll() error }:
×
2396
                        if err := v.ValidateAll(); err != nil {
×
2397
                                errors = append(errors, CollectionHashedReadWriteSetValidationError{
×
2398
                                        field:  "HashedRwset",
×
2399
                                        reason: "embedded message failed validation",
×
2400
                                        cause:  err,
×
2401
                                })
×
2402
                        }
×
2403
                case interface{ Validate() error }:
×
2404
                        if err := v.Validate(); err != nil {
×
2405
                                errors = append(errors, CollectionHashedReadWriteSetValidationError{
×
2406
                                        field:  "HashedRwset",
×
2407
                                        reason: "embedded message failed validation",
×
2408
                                        cause:  err,
×
2409
                                })
×
2410
                        }
×
2411
                }
2412
        } else if v, ok := interface{}(m.GetHashedRwset()).(interface{ Validate() error }); ok {
×
2413
                if err := v.Validate(); err != nil {
×
2414
                        return CollectionHashedReadWriteSetValidationError{
×
2415
                                field:  "HashedRwset",
×
2416
                                reason: "embedded message failed validation",
×
2417
                                cause:  err,
×
2418
                        }
×
2419
                }
×
2420
        }
2421

2422
        // no validation rules for PvtRwsetHash
2423

2424
        if len(errors) > 0 {
×
2425
                return CollectionHashedReadWriteSetMultiError(errors)
×
2426
        }
×
2427

2428
        return nil
×
2429
}
2430

2431
// CollectionHashedReadWriteSetMultiError is an error wrapping multiple
2432
// validation errors returned by CollectionHashedReadWriteSet.ValidateAll() if
2433
// the designated constraints aren't met.
2434
type CollectionHashedReadWriteSetMultiError []error
2435

2436
// Error returns a concatenation of all the error messages it wraps.
2437
func (m CollectionHashedReadWriteSetMultiError) Error() string {
×
2438
        var msgs []string
×
2439
        for _, err := range m {
×
2440
                msgs = append(msgs, err.Error())
×
2441
        }
×
2442
        return strings.Join(msgs, "; ")
×
2443
}
2444

2445
// AllErrors returns a list of validation violation errors.
2446
func (m CollectionHashedReadWriteSetMultiError) AllErrors() []error { return m }
×
2447

2448
// CollectionHashedReadWriteSetValidationError is the validation error returned
2449
// by CollectionHashedReadWriteSet.Validate if the designated constraints
2450
// aren't met.
2451
type CollectionHashedReadWriteSetValidationError struct {
2452
        field  string
2453
        reason string
2454
        cause  error
2455
        key    bool
2456
}
2457

2458
// Field function returns field value.
2459
func (e CollectionHashedReadWriteSetValidationError) Field() string { return e.field }
×
2460

2461
// Reason function returns reason value.
2462
func (e CollectionHashedReadWriteSetValidationError) Reason() string { return e.reason }
×
2463

2464
// Cause function returns cause value.
2465
func (e CollectionHashedReadWriteSetValidationError) Cause() error { return e.cause }
×
2466

2467
// Key function returns key value.
2468
func (e CollectionHashedReadWriteSetValidationError) Key() bool { return e.key }
×
2469

2470
// ErrorName returns error name.
2471
func (e CollectionHashedReadWriteSetValidationError) ErrorName() string {
×
2472
        return "CollectionHashedReadWriteSetValidationError"
×
2473
}
×
2474

2475
// Error satisfies the builtin error interface
2476
func (e CollectionHashedReadWriteSetValidationError) Error() string {
×
2477
        cause := ""
×
2478
        if e.cause != nil {
×
2479
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
2480
        }
×
2481

2482
        key := ""
×
2483
        if e.key {
×
2484
                key = "key for "
×
2485
        }
×
2486

2487
        return fmt.Sprintf(
×
2488
                "invalid %sCollectionHashedReadWriteSet.%s: %s%s",
×
2489
                key,
×
2490
                e.field,
×
2491
                e.reason,
×
2492
                cause)
×
2493
}
2494

2495
var _ error = CollectionHashedReadWriteSetValidationError{}
2496

2497
var _ interface {
2498
        Field() string
2499
        Reason() string
2500
        Key() bool
2501
        Cause() error
2502
        ErrorName() string
2503
} = CollectionHashedReadWriteSetValidationError{}
2504

2505
// Validate checks the field values on Endorsement with the rules defined in
2506
// the proto definition for this message. If any rules are violated, the first
2507
// error encountered is returned, or nil if there are no violations.
2508
func (m *Endorsement) Validate() error {
×
2509
        return m.validate(false)
×
2510
}
×
2511

2512
// ValidateAll checks the field values on Endorsement with the rules defined in
2513
// the proto definition for this message. If any rules are violated, the
2514
// result is a list of violation errors wrapped in EndorsementMultiError, or
2515
// nil if none found.
2516
func (m *Endorsement) ValidateAll() error {
×
2517
        return m.validate(true)
×
2518
}
×
2519

2520
func (m *Endorsement) validate(all bool) error {
×
2521
        if m == nil {
×
2522
                return nil
×
2523
        }
×
2524

2525
        var errors []error
×
2526

×
2527
        if all {
×
2528
                switch v := interface{}(m.GetEndorser()).(type) {
×
2529
                case interface{ ValidateAll() error }:
×
2530
                        if err := v.ValidateAll(); err != nil {
×
2531
                                errors = append(errors, EndorsementValidationError{
×
2532
                                        field:  "Endorser",
×
2533
                                        reason: "embedded message failed validation",
×
2534
                                        cause:  err,
×
2535
                                })
×
2536
                        }
×
2537
                case interface{ Validate() error }:
×
2538
                        if err := v.Validate(); err != nil {
×
2539
                                errors = append(errors, EndorsementValidationError{
×
2540
                                        field:  "Endorser",
×
2541
                                        reason: "embedded message failed validation",
×
2542
                                        cause:  err,
×
2543
                                })
×
2544
                        }
×
2545
                }
2546
        } else if v, ok := interface{}(m.GetEndorser()).(interface{ Validate() error }); ok {
×
2547
                if err := v.Validate(); err != nil {
×
2548
                        return EndorsementValidationError{
×
2549
                                field:  "Endorser",
×
2550
                                reason: "embedded message failed validation",
×
2551
                                cause:  err,
×
2552
                        }
×
2553
                }
×
2554
        }
2555

2556
        // no validation rules for Signature
2557

2558
        if len(errors) > 0 {
×
2559
                return EndorsementMultiError(errors)
×
2560
        }
×
2561

2562
        return nil
×
2563
}
2564

2565
// EndorsementMultiError is an error wrapping multiple validation errors
2566
// returned by Endorsement.ValidateAll() if the designated constraints aren't met.
2567
type EndorsementMultiError []error
2568

2569
// Error returns a concatenation of all the error messages it wraps.
2570
func (m EndorsementMultiError) Error() string {
×
2571
        var msgs []string
×
2572
        for _, err := range m {
×
2573
                msgs = append(msgs, err.Error())
×
2574
        }
×
2575
        return strings.Join(msgs, "; ")
×
2576
}
2577

2578
// AllErrors returns a list of validation violation errors.
2579
func (m EndorsementMultiError) AllErrors() []error { return m }
×
2580

2581
// EndorsementValidationError is the validation error returned by
2582
// Endorsement.Validate if the designated constraints aren't met.
2583
type EndorsementValidationError struct {
2584
        field  string
2585
        reason string
2586
        cause  error
2587
        key    bool
2588
}
2589

2590
// Field function returns field value.
2591
func (e EndorsementValidationError) Field() string { return e.field }
×
2592

2593
// Reason function returns reason value.
2594
func (e EndorsementValidationError) Reason() string { return e.reason }
×
2595

2596
// Cause function returns cause value.
2597
func (e EndorsementValidationError) Cause() error { return e.cause }
×
2598

2599
// Key function returns key value.
2600
func (e EndorsementValidationError) Key() bool { return e.key }
×
2601

2602
// ErrorName returns error name.
2603
func (e EndorsementValidationError) ErrorName() string { return "EndorsementValidationError" }
×
2604

2605
// Error satisfies the builtin error interface
2606
func (e EndorsementValidationError) Error() string {
×
2607
        cause := ""
×
2608
        if e.cause != nil {
×
2609
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
2610
        }
×
2611

2612
        key := ""
×
2613
        if e.key {
×
2614
                key = "key for "
×
2615
        }
×
2616

2617
        return fmt.Sprintf(
×
2618
                "invalid %sEndorsement.%s: %s%s",
×
2619
                key,
×
2620
                e.field,
×
2621
                e.reason,
×
2622
                cause)
×
2623
}
2624

2625
var _ error = EndorsementValidationError{}
2626

2627
var _ interface {
2628
        Field() string
2629
        Reason() string
2630
        Key() bool
2631
        Cause() error
2632
        ErrorName() string
2633
} = EndorsementValidationError{}
2634

2635
// Validate checks the field values on BlockMetadata with the rules defined in
2636
// the proto definition for this message. If any rules are violated, the first
2637
// error encountered is returned, or nil if there are no violations.
2638
func (m *BlockMetadata) Validate() error {
×
2639
        return m.validate(false)
×
2640
}
×
2641

2642
// ValidateAll checks the field values on BlockMetadata with the rules defined
2643
// in the proto definition for this message. If any rules are violated, the
2644
// result is a list of violation errors wrapped in BlockMetadataMultiError, or
2645
// nil if none found.
2646
func (m *BlockMetadata) ValidateAll() error {
×
2647
        return m.validate(true)
×
2648
}
×
2649

2650
func (m *BlockMetadata) validate(all bool) error {
×
2651
        if m == nil {
×
2652
                return nil
×
2653
        }
×
2654

2655
        var errors []error
×
2656

×
2657
        for idx, item := range m.GetOrdererSignatures() {
×
2658
                _, _ = idx, item
×
2659

×
2660
                if all {
×
2661
                        switch v := interface{}(item).(type) {
×
2662
                        case interface{ ValidateAll() error }:
×
2663
                                if err := v.ValidateAll(); err != nil {
×
2664
                                        errors = append(errors, BlockMetadataValidationError{
×
2665
                                                field:  fmt.Sprintf("OrdererSignatures[%v]", idx),
×
2666
                                                reason: "embedded message failed validation",
×
2667
                                                cause:  err,
×
2668
                                        })
×
2669
                                }
×
2670
                        case interface{ Validate() error }:
×
2671
                                if err := v.Validate(); err != nil {
×
2672
                                        errors = append(errors, BlockMetadataValidationError{
×
2673
                                                field:  fmt.Sprintf("OrdererSignatures[%v]", idx),
×
2674
                                                reason: "embedded message failed validation",
×
2675
                                                cause:  err,
×
2676
                                        })
×
2677
                                }
×
2678
                        }
2679
                } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
×
2680
                        if err := v.Validate(); err != nil {
×
2681
                                return BlockMetadataValidationError{
×
2682
                                        field:  fmt.Sprintf("OrdererSignatures[%v]", idx),
×
2683
                                        reason: "embedded message failed validation",
×
2684
                                        cause:  err,
×
2685
                                }
×
2686
                        }
×
2687
                }
2688

2689
        }
2690

2691
        if len(errors) > 0 {
×
2692
                return BlockMetadataMultiError(errors)
×
2693
        }
×
2694

2695
        return nil
×
2696
}
2697

2698
// BlockMetadataMultiError is an error wrapping multiple validation errors
2699
// returned by BlockMetadata.ValidateAll() if the designated constraints
2700
// aren't met.
2701
type BlockMetadataMultiError []error
2702

2703
// Error returns a concatenation of all the error messages it wraps.
2704
func (m BlockMetadataMultiError) Error() string {
×
2705
        var msgs []string
×
2706
        for _, err := range m {
×
2707
                msgs = append(msgs, err.Error())
×
2708
        }
×
2709
        return strings.Join(msgs, "; ")
×
2710
}
2711

2712
// AllErrors returns a list of validation violation errors.
2713
func (m BlockMetadataMultiError) AllErrors() []error { return m }
×
2714

2715
// BlockMetadataValidationError is the validation error returned by
2716
// BlockMetadata.Validate if the designated constraints aren't met.
2717
type BlockMetadataValidationError struct {
2718
        field  string
2719
        reason string
2720
        cause  error
2721
        key    bool
2722
}
2723

2724
// Field function returns field value.
2725
func (e BlockMetadataValidationError) Field() string { return e.field }
×
2726

2727
// Reason function returns reason value.
2728
func (e BlockMetadataValidationError) Reason() string { return e.reason }
×
2729

2730
// Cause function returns cause value.
2731
func (e BlockMetadataValidationError) Cause() error { return e.cause }
×
2732

2733
// Key function returns key value.
2734
func (e BlockMetadataValidationError) Key() bool { return e.key }
×
2735

2736
// ErrorName returns error name.
2737
func (e BlockMetadataValidationError) ErrorName() string { return "BlockMetadataValidationError" }
×
2738

2739
// Error satisfies the builtin error interface
2740
func (e BlockMetadataValidationError) Error() string {
×
2741
        cause := ""
×
2742
        if e.cause != nil {
×
2743
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
2744
        }
×
2745

2746
        key := ""
×
2747
        if e.key {
×
2748
                key = "key for "
×
2749
        }
×
2750

2751
        return fmt.Sprintf(
×
2752
                "invalid %sBlockMetadata.%s: %s%s",
×
2753
                key,
×
2754
                e.field,
×
2755
                e.reason,
×
2756
                cause)
×
2757
}
2758

2759
var _ error = BlockMetadataValidationError{}
2760

2761
var _ interface {
2762
        Field() string
2763
        Reason() string
2764
        Key() bool
2765
        Cause() error
2766
        ErrorName() string
2767
} = BlockMetadataValidationError{}
2768

2769
// Validate checks the field values on OrdererSignature with the rules defined
2770
// in the proto definition for this message. If any rules are violated, the
2771
// first error encountered is returned, or nil if there are no violations.
2772
func (m *OrdererSignature) Validate() error {
×
2773
        return m.validate(false)
×
2774
}
×
2775

2776
// ValidateAll checks the field values on OrdererSignature with the rules
2777
// defined in the proto definition for this message. If any rules are
2778
// violated, the result is a list of violation errors wrapped in
2779
// OrdererSignatureMultiError, or nil if none found.
2780
func (m *OrdererSignature) ValidateAll() error {
×
2781
        return m.validate(true)
×
2782
}
×
2783

2784
func (m *OrdererSignature) validate(all bool) error {
×
2785
        if m == nil {
×
2786
                return nil
×
2787
        }
×
2788

2789
        var errors []error
×
2790

×
2791
        if all {
×
2792
                switch v := interface{}(m.GetIdentity()).(type) {
×
2793
                case interface{ ValidateAll() error }:
×
2794
                        if err := v.ValidateAll(); err != nil {
×
2795
                                errors = append(errors, OrdererSignatureValidationError{
×
2796
                                        field:  "Identity",
×
2797
                                        reason: "embedded message failed validation",
×
2798
                                        cause:  err,
×
2799
                                })
×
2800
                        }
×
2801
                case interface{ Validate() error }:
×
2802
                        if err := v.Validate(); err != nil {
×
2803
                                errors = append(errors, OrdererSignatureValidationError{
×
2804
                                        field:  "Identity",
×
2805
                                        reason: "embedded message failed validation",
×
2806
                                        cause:  err,
×
2807
                                })
×
2808
                        }
×
2809
                }
2810
        } else if v, ok := interface{}(m.GetIdentity()).(interface{ Validate() error }); ok {
×
2811
                if err := v.Validate(); err != nil {
×
2812
                        return OrdererSignatureValidationError{
×
2813
                                field:  "Identity",
×
2814
                                reason: "embedded message failed validation",
×
2815
                                cause:  err,
×
2816
                        }
×
2817
                }
×
2818
        }
2819

2820
        // no validation rules for Signature
2821

2822
        if len(errors) > 0 {
×
2823
                return OrdererSignatureMultiError(errors)
×
2824
        }
×
2825

2826
        return nil
×
2827
}
2828

2829
// OrdererSignatureMultiError is an error wrapping multiple validation errors
2830
// returned by OrdererSignature.ValidateAll() if the designated constraints
2831
// aren't met.
2832
type OrdererSignatureMultiError []error
2833

2834
// Error returns a concatenation of all the error messages it wraps.
2835
func (m OrdererSignatureMultiError) Error() string {
×
2836
        var msgs []string
×
2837
        for _, err := range m {
×
2838
                msgs = append(msgs, err.Error())
×
2839
        }
×
2840
        return strings.Join(msgs, "; ")
×
2841
}
2842

2843
// AllErrors returns a list of validation violation errors.
2844
func (m OrdererSignatureMultiError) AllErrors() []error { return m }
×
2845

2846
// OrdererSignatureValidationError is the validation error returned by
2847
// OrdererSignature.Validate if the designated constraints aren't met.
2848
type OrdererSignatureValidationError struct {
2849
        field  string
2850
        reason string
2851
        cause  error
2852
        key    bool
2853
}
2854

2855
// Field function returns field value.
2856
func (e OrdererSignatureValidationError) Field() string { return e.field }
×
2857

2858
// Reason function returns reason value.
2859
func (e OrdererSignatureValidationError) Reason() string { return e.reason }
×
2860

2861
// Cause function returns cause value.
2862
func (e OrdererSignatureValidationError) Cause() error { return e.cause }
×
2863

2864
// Key function returns key value.
2865
func (e OrdererSignatureValidationError) Key() bool { return e.key }
×
2866

2867
// ErrorName returns error name.
2868
func (e OrdererSignatureValidationError) ErrorName() string { return "OrdererSignatureValidationError" }
×
2869

2870
// Error satisfies the builtin error interface
2871
func (e OrdererSignatureValidationError) Error() string {
×
2872
        cause := ""
×
2873
        if e.cause != nil {
×
2874
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
2875
        }
×
2876

2877
        key := ""
×
2878
        if e.key {
×
2879
                key = "key for "
×
2880
        }
×
2881

2882
        return fmt.Sprintf(
×
2883
                "invalid %sOrdererSignature.%s: %s%s",
×
2884
                key,
×
2885
                e.field,
×
2886
                e.reason,
×
2887
                cause)
×
2888
}
2889

2890
var _ error = OrdererSignatureValidationError{}
2891

2892
var _ interface {
2893
        Field() string
2894
        Reason() string
2895
        Key() bool
2896
        Cause() error
2897
        ErrorName() string
2898
} = OrdererSignatureValidationError{}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc