bouncer/internal/schema/validate.go
William Petit 8d91f646c2
All checks were successful
Cadoles/bouncer/pipeline/head This commit looks good
feat: refactor layers registration
2023-06-23 17:54:34 -06:00

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
}