@metreeca/blue - v0.10.0
    Preparing search index...

    Function reference

    • Creates a reference shape for the given target resource shape.

      Warning

      The target shape must include an Id property. This constraint is checked at runtime but not at compile time due to limitations with recursive type inference.

      Tip

      Always dereference ReferenceShape.shape through resource() rather than calling the factory directly, to ensure the resulting shape is fully flattened.

      Parameters

      • shape: Lazy<ResourceShape>

        The target resource shape, either directly or as a lazy function to support circular and self-referential definitions

      • Optionalconstraints: ReferenceConstraints

        Optional constraints controlling link ownership and lifecycle

      Returns ReferenceShape

      An immutable ReferenceShape for validating resource references

      const vendor = required(reference(Vendor));
      const children = multiple(reference(Target, { foreign: true }));
      const parts = multiple(reference(Part, { captive: true }));