MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / ValidatePath

Function ValidatePath

pkg/ijson/ijson.go:560–578  ·  view source on GitHub ↗
(path any)

Source from the content-addressed store, hash-verified

558}
559
560func 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
580func ValidateAndMarshalCommand(command Command) ([]byte, error) {
581 cmdType := getCommandType(command)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected