core.patchoptions.implicitarraycreation
Home > @medplum/core > PatchOptions > implicitArrayCreation
PatchOptions.implicitArrayCreation property
When true, "add" operations with path ending in "/-" will implicitly create an empty array where possible.
For example, with this option enabled, for the object {live: true}, the operation add "/tag/-" 123 will result in {live: true, tag: [123]}. Subsequent operations behave normally: another add "/tag/-" 456 will result in {live: true, tag: [123, 456]}.
If the indicated array property already exists but is not an array, this will produce an error.
Only the leaf array will be inferred; missing parent objects will still produce errors.
Signature:
implicitArrayCreation?: boolean;