ExCedar.Schema (ex_cedar v0.1.2)

Copy Markdown View Source

Compiled Cedar schema handle.

Accepts human-syntax Cedar schemas via compile/1 and Cedar JSON schemas via from_json/1. The compiled handle is immutable, thread-safe, and can be passed to ExCedar.Validator.validate/3 or supplied as the schema: option on ExCedar.Authorizer.authorize/4.

Like all compiled handles, it does not survive a node restart.

Summary

Functions

Parses human-syntax Cedar schema text and returns a compiled handle.

Like compile/1 but raises an ExCedar.Error exception on failure.

Parses a Cedar JSON schema (binary string or map) and returns a compiled handle.

Like from_json/1 but raises an ExCedar.Error exception on failure.

Functions

compile(text)

Parses human-syntax Cedar schema text and returns a compiled handle.

Returns {:error, %ExCedar.Error.Invalid{}} on a schema syntax error.

compile!(text)

Like compile/1 but raises an ExCedar.Error exception on failure.

from_json(json)

Parses a Cedar JSON schema (binary string or map) and returns a compiled handle.

Returns {:error, %ExCedar.Error.Invalid{}} on a schema error.

from_json!(json)

Like from_json/1 but raises an ExCedar.Error exception on failure.