func()

in pkg/runner/file_system_step_resource.go [28:52]


func (sr *FileSystemStepResource) Fetch(_ context.Context, view *expression.InterpolationContext) (*SpecDefinition, error) {
	stepDir, err := sr.stepDir(view)
	if err != nil {
		return nil, fmt.Errorf("fetching step from file: %w", err)
	}

	stepFile := filepath.Join(stepDir, sr.filename)

	spec, step, err := schema.LoadSteps(stepFile)
	if err != nil {
		return nil, fmt.Errorf("loading file %q: %w", stepFile, err)
	}

	protoSpec, err := spec.Compile()
	if err != nil {
		return nil, fmt.Errorf("compiling proto specification: %w", err)
	}

	protoDef, err := step.Compile()
	if err != nil {
		return nil, fmt.Errorf("compiling proto definition: %w", err)
	}

	return NewSpecDefinition(protoSpec, protoDef, stepDir), nil
}