Default application namespace for property IRI resolution (app:/#).
Property definitions for a ResourceShape.
A property definition entry.
Checks that child property overrides are assignable to inherited types.
Extracts inherited model types from ResourceConstraints.extends.
Extracts explicitly declared properties, stripping index signatures.
Converts a union type to an intersection type.
Builds a resource type from Entries.
Strips the =expression suffix from a property key.
Extracts the content type from an Entry.
Extracts keys of required properties from Entries.
Extracts keys of optional properties from Entries.
Maps SHACL cardinality constraints to TypeScript types.
Shape definition for resource references.
Shape definition for linked data resources.
Constraints for resource shape factories.
Marker interface for the resource identifier property.
Marker interface for the resource type property.
Shape definition for a resource property.
Constraints for property shape factories.
Shape for a set of values linked from a resource by a property.
Discriminated type alternatives for polymorphic property values.
Checks whether a value is a ReferenceShape.
Checks whether a value is a valid ResourceShape.
Checks whether a value is a valid ResourceConstraints object.
Checks whether a value is a valid Id.
Checks whether a value is a valid Type.
Checks whether a value is a valid Property.
Checks whether a value is a valid PropertyConstraints object.
Checks whether a value is a valid Range.
Checks whether a value is a valid Union.
Checks whether a value is a valid Entries object.
Checks whether a value is a valid Entry.
Creates a reference shape for the given target resource shape.
Creates a backlink reference shape for the given target resource shape.
Creates resource shapes.
Creates a property shape for the resource identifier.
Creates a property shape for the resource type.
Creates property shapes.
Creates a union of named value shapes.
Creates a value range with no cardinality constraints (0..*).
Creates a value range requiring at least one value (1..*).
Creates a value range for at most one value (0..1).
Creates a value range for exactly one value (1..1).
Creates a value range factory with custom cardinality constraints.
Resource shape model and factories.
Provides shapes for validating linked data resources with property definitions, cardinality constraints, and inheritance. Resource shapes define the expected structure of linked data resources using a SHACL-based model with compile-time type inference.
Factories check structural integrity of constraints but not their logical consistency: contradictory constraints like
minCount > maxCountwon't be rejected, nor will inconsistencies with inherited definitions.Resource shapes are closed: validated resources may only contain properties explicitly defined in the shape. Any additional properties will cause validation to fail.
All IRI values in validated resources must be absolute. When decoding client input, relative references may be auto‑resolved using the
baseoption in decodeResource, decodePatch, or decodeQuery.Defining Resource Shapes
Combine property definitions with value ranges to define resource structures:
Properties and Ranges
Ranges define cardinality constraints for property values:
Naked ranges are automatically wrapped in a property; use explicit property when IRI mappings or labels are needed:
Resource References and Embedding
Resource properties link to other resources in two ways. A reference wrapper links to a standalone resource — an independently identified and managed entity. A direct shape inclusion defines an embedded resource — a nested object with no independent identity, created and managed together with its parent.
In state and patch validation, embedded resources are always validated as complete states — patch semantics (missing properties accepted, custom validators skipped) apply only at the top level.
Use backlink for reverse links managed by the target resource. Backlinks are read-only from the source resource perspective: included in responses but rejected in state updates and patches.
Self-referential shapes use lazy factories:
Inheritance
Extend parent shapes to inherit properties and constraints:
Polymorphic Properties
Use union for properties accepting multiple value types. Unions are pure type discriminators — cardinality constraints belong on the enclosing Range, not on individual variants. At runtime, union values are represented as Indexed records mapping variant names to their values, corresponding to JSON-LD indexed containers (
@container: @index):Variant keys act as discriminators in runtime values:
See