// ReadSpecStep ... func ReadSpecStep(pth string) (stepmanModels.StepModel, error) { if isExists, err := pathutil.IsPathExists(pth); err != nil { return stepmanModels.StepModel{}, err } else if !isExists { return stepmanModels.StepModel{}, errors.New(fmt.Sprint("No file found at path", pth)) } bytes, err := ioutil.ReadFile(pth) if err != nil { return stepmanModels.StepModel{}, err } var stepModel stepmanModels.StepModel if err := yaml.Unmarshal(bytes, &stepModel); err != nil { return stepmanModels.StepModel{}, err } if err := stepModel.Normalize(); err != nil { return stepmanModels.StepModel{}, err } if err := stepModel.ValidateStep(); err != nil { return stepmanModels.StepModel{}, err } if err := stepModel.FillMissingDefaults(); err != nil { return stepmanModels.StepModel{}, err } return stepModel, nil }