Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

service: removed Task.GetInputParameter() since it's not used anywhere #886

Merged
merged 3 commits into from
Apr 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions service/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@ func (e *TaskNotFoundError) Error() string {
return fmt.Sprintf("Task %q not found in service %q", e.TaskKey, e.ServiceName)
}

// TaskInputNotFoundError is an error returned when service doesn't contain corresponding input.
type TaskInputNotFoundError struct {
TaskKey string
TaskInputKey string
ServiceName string
}

func (e *TaskInputNotFoundError) Error() string {
return fmt.Sprintf("Input %q of task %q not found in service %q", e.TaskInputKey, e.TaskKey,
e.ServiceName)
}

// TaskOutputNotFoundError is an error returned when service doesn't contain corresponding output.
type TaskOutputNotFoundError struct {
TaskKey string
Expand Down
10 changes: 0 additions & 10 deletions service/error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,3 @@ func TestInvalidOutputDataError(t *testing.T) {
require.Contains(t, err.Error(), `Outputs "OutputKey" of task "TaskKey" are invalid in service "TestInvalidOutputDataError"`)
tests.assert(t, err.Error())
}

// Test InputNotFoundError
func TestInputNotFoundError(t *testing.T) {
err := TaskInputNotFoundError{
TaskKey: "TaskKey",
TaskInputKey: "InputKey",
ServiceName: "InputNotFoundError",
}
require.Equal(t, `Input "InputKey" of task "TaskKey" not found in service "InputNotFoundError"`, err.Error())
}
14 changes: 0 additions & 14 deletions service/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,6 @@ func (s *Service) GetTask(taskKey string) (*Task, error) {
}
}

// GetInputParameter returns input inputKey parameter of task.
func (t *Task) GetInputParameter(inputKey string) (*Parameter, error) {
for _, input := range t.Inputs {
if input.Key == inputKey {
return input, nil
}
}
return nil, &TaskInputNotFoundError{
TaskKey: t.Key,
TaskInputKey: inputKey,
ServiceName: t.serviceName,
}
}

// ValidateInputs produces warnings for task inputs that doesn't satisfy their parameter schemas.
func (t *Task) ValidateInputs(taskInputs map[string]interface{}) []*ParameterWarning {
return validateParametersSchema(t.Inputs, taskInputs)
Expand Down