MCPcopy Create free account
hub / github.com/devfile/api / validateCommand

Function validateCommand

pkg/validation/commands.go:65–76  ·  view source on GitHub ↗

validateCommand validates a given devfile command where parentCommands is a map to track all the parent commands when validating the composite command's subcommands recursively and devfileCommands is a map of command id to the devfile command

(command v1alpha2.Command, parentCommands map[string]string, devfileCommands map[string]v1alpha2.Command, components []v1alpha2.Component)

Source from the content-addressed store, hash-verified

63// validateCommand validates a given devfile command where parentCommands is a map to track all the parent commands when validating
64// the composite command's subcommands recursively and devfileCommands is a map of command id to the devfile command
65func validateCommand(command v1alpha2.Command, parentCommands map[string]string, devfileCommands map[string]v1alpha2.Command, components []v1alpha2.Component) error {
66
67 switch {
68 case command.Composite != nil:
69 return validateCompositeCommand(&command, parentCommands, devfileCommands, components)
70 case command.Exec != nil || command.Apply != nil:
71 return validateCommandComponent(command, components)
72 default:
73 return &InvalidCommandTypeError{commandId: command.Id}
74 }
75
76}
77
78// validateGroup validates commands belonging to a specific group kind. If there are multiple commands belonging to the same group:
79// 1. without any default, err out

Callers 2

ValidateCommandsFunction · 0.85
validateCompositeCommandFunction · 0.85

Calls 2

validateCompositeCommandFunction · 0.85
validateCommandComponentFunction · 0.85

Tested by

no test coverage detected