(path any)
| 558 | } |
| 559 | |
| 560 | func ValidatePath(path any) error { |
| 561 | if path == nil { |
| 562 | // nil path is allowed (sets the root) |
| 563 | return nil |
| 564 | } |
| 565 | pathArr, ok := path.([]any) |
| 566 | if !ok { |
| 567 | return fmt.Errorf("path is not an array") |
| 568 | } |
| 569 | for idx, elem := range pathArr { |
| 570 | switch elem.(type) { |
| 571 | case string, int: |
| 572 | continue |
| 573 | default: |
| 574 | return fmt.Errorf("path element %d is not a string or int", idx) |
| 575 | } |
| 576 | } |
| 577 | return nil |
| 578 | } |
| 579 | |
| 580 | func ValidateAndMarshalCommand(command Command) ([]byte, error) { |
| 581 | cmdType := getCommandType(command) |
no outgoing calls
no test coverage detected