func (s *Service) RequireTaskOutputs(taskKey string, outputs *types.Struct) error {
	t, err := s.GetTask(taskKey)
	if err != nil {
		return err
	}
	if err := validateServiceParameters(t.Outputs, outputs); err != nil {
		return fmt.Errorf("service %q - outputs of task %q are invalid: %s", s.Name, taskKey, err)
	}
	return nil
}
RequireTaskOutputs requires task outputs to match with parameter schemas.
package service
import (
	"fmt"
	sdk "github.com/cosmos/cosmos-sdk/types"
	"github.com/mesg-foundation/engine/hash"
	"github.com/mesg-foundation/engine/protobuf/types"
	"github.com/tendermint/tendermint/crypto"
)
func New(sid, name, description string, configuration Service_Configuration, tasks []*Service_Task, events []*Service_Event, dependencies []*Service_Dependency, repository, source string) (*Service, error) {
	srv := &Service{
		Sid:           sid,
		Name:          name,
		Description:   description,
		Configuration: configuration,
		Tasks:         tasks,
		Events:        events,
		Dependencies:  dependencies,
		Repository:    repository,
		Source:        source,
	}
	srv.Hash = hash.Dump(srv)
	srv.Address = sdk.AccAddress(crypto.AddressHash(srv.Hash))
	if srv.Sid == "" {
		srv.Sid = "_" + srv.Hash.String()
	}
	return srv, srv.Validate()
}
const MainServiceKey = "service"
func (s *Service) GetDependency(dependencyKey string) (*Service_Dependency, error) {
	for _, dep := range s.Dependencies {
		if dep.Key == dependencyKey {
			return dep, nil
		}
	}
	return nil, fmt.Errorf("service %q - dependency %s does not exist", s.Name, dependencyKey)
}
func (s *Service) GetTask(taskKey string) (*Service_Task, error) {
	for _, task := range s.Tasks {
		if task.Key == taskKey {
			return task, nil
		}
	}
	return nil, fmt.Errorf("service %q - task %q not found", s.Name, taskKey)
}
func (s *Service) GetEvent(eventKey string) (*Service_Event, error) {
	for _, event := range s.Events {
		if event.Key == eventKey {
			return event, nil
		}
	}
	return nil, fmt.Errorf("service %q - event %q not found", s.Name, eventKey)
}
func (s *Service) RequireTaskInputs(taskKey string, inputs *types.Struct) error {
	t, err := s.GetTask(taskKey)
	if err != nil {
		return err
	}
	if err := validateServiceParameters(t.Inputs, inputs); err != nil {
		return fmt.Errorf("service %q - inputs of task %q are invalid: %s", s.Name, taskKey, err)
	}
	return nil
}