Builtin Library
README.md
asset_tag (module)
The assetTag field-constraint validator. Registers itself with
field_constraints.module's registry on load so any component field
carrying constraint = { kind = "assetTag", tag = ... } — which is
exactly what Field.taggedRef emits — is checked against it.
What it does
Given a field's written value and its constraint:
- Passes
nil— an unset slot holds nothing to check. - Reads the value's identity — a bare string, or a table's
__ref/guid/identity/name. - Resolves it as an asset of any type (
asset.resolve(identity)), since the tag is the whole gate. - Answers
asset.has_tag(identity, constraint.tag).
Acceptance rides on the tag rather than the asset's type, so an asset becomes assignable to a tagged slot the moment it is tagged — no edit to the field or to anything that reads it.
A rejection names the tag the slot wants, the tags the asset carries
instead, and the asset.list({ fields = { tags = ... } }) call that
enumerates what would fit, so the message carries its own next step.
Exports
M.check(value, constraint) -> ok, reason?— the validator function, also registered under theassetTagkind.