updated the interface to return a Error struct and modified the function and tests accordingly
This commit is contained in:
@@ -5,12 +5,18 @@ import (
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// Error struct for validation errors
|
||||
type Error struct {
|
||||
Path string
|
||||
Message string
|
||||
}
|
||||
|
||||
// Validator interface for schema validation
|
||||
type Validator interface {
|
||||
Validate(ctx context.Context, url url.URL, payload []byte) (bool, error)
|
||||
Validate(ctx context.Context, url *url.URL, payload []byte) (bool, Error)
|
||||
}
|
||||
|
||||
// ValidatorProvider interface for creating validators
|
||||
type ValidatorProvider interface {
|
||||
New(ctx context.Context, config map[string]string) (map[string]Validator, error)
|
||||
New(ctx context.Context, config map[string]string) (map[string]Validator, Error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user