William Petit
8d91f646c2
All checks were successful
Cadoles/bouncer/pipeline/head This commit looks good
18 lines
291 B
Go
18 lines
291 B
Go
package schema
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
func Validate(ctx context.Context, schema *Schema, data map[string]any) error {
|
|
state := schema.Validate(ctx, data)
|
|
|
|
if len(*state.Errs) > 0 {
|
|
return errors.WithStack(NewInvalidDataError(*state.Errs...))
|
|
}
|
|
|
|
return nil
|
|
}
|