validate

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Validator)

Option configures a Validator.

func WithPermissive

func WithPermissive() Option

WithPermissive returns an Option that enables permissive validation mode.

func WithStrict

func WithStrict() Option

WithStrict returns an Option that enables strict validation mode (default).

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

Validator validates Cedar policies, entities, and requests against a resolved schema.

func New

func New(s *resolved.Schema, opts ...Option) *Validator

New creates a Validator for the given schema. By default, strict mode is enabled.

func (*Validator) Entities

func (v *Validator) Entities(entities types.EntityMap) error

Entities validates all entities in the map against the schema. Returns a single flat error matching Rust Cedar's format: "entity does not conform to the schema" or "error during entity deserialization".

func (*Validator) Entity

func (v *Validator) Entity(entity types.Entity) error

Entity validates a single entity against the schema.

func (*Validator) Policy

func (v *Validator) Policy(policyID string, policy *ast.Policy) error

Policy validates a policy against the schema, performing scope validation and expression type checking.

func (*Validator) Request

func (v *Validator) Request(req types.Request) error

Request validates a request against the schema.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL