update on the review comments

This commit is contained in:
MohitKatare-protean
2025-04-08 16:28:33 +05:30
parent cf4b397249
commit 0a210d4f31
4 changed files with 13 additions and 14 deletions

View File

@@ -105,7 +105,7 @@ func (s *validateSignStep) validate(ctx *model.StepContext, value string) error
headerParts := strings.Split(value, "|")
ids := strings.Split(headerParts[0], "\"")
if len(ids) < 2 || len(headerParts) < 3 {
return model.NewBadReqErr(fmt.Errorf("malformed sign header"))
return fmt.Errorf("malformed sign header")
}
subID := ids[1]
keyID := headerParts[1]
@@ -114,7 +114,7 @@ func (s *validateSignStep) validate(ctx *model.StepContext, value string) error
return fmt.Errorf("failed to get validation key: %w", err)
}
if err := s.validator.Validate(ctx, ctx.Body, value, key); err != nil {
return model.NewSignValidationErr(fmt.Errorf("sign validation failed: %w", err))
return fmt.Errorf("sign validation failed: %w", err)
}
return nil
}
@@ -136,7 +136,7 @@ func newValidateSchemaStep(schemaValidator definition.SchemaValidator) (definiti
// Run executes the schema validation step.
func (s *validateSchemaStep) Run(ctx *model.StepContext) error {
if err := s.validator.Validate(ctx, ctx.Request.URL, ctx.Body); err != nil {
return err.(*model.SchemaValidationErr).BecknError()
return fmt.Errorf("schema validation failed: %w", err)
}
return nil
}