Skip to content

Support templates or concatenation of several fields into one #36

Description

@Mearman

A rule had one from and one to, so several source fields could not feed a single target. Concatenation also has no unique inverse unless the joined text is structured, which is why decode could not be derived from one declaration the way it is for split.

Decision: implement a two-way template rule that records the part boundaries in the template itself: { op: "template", from: { given: "people[].given", family: "people[].family" }, to: "names[]", template: "{family}, {given}" }. Placeholders are {name}, a literal brace is {{ or }}. The schema refuses a template without a unique inverse: a field used twice or not at all, a placeholder naming no field, or two placeholders with no literal between them. Decode strips the leading and trailing literals and cuts each field at the first occurrence of the literal after it; encode renders and immediately splits its own output back, throwing for a value that contains the literal following its placeholder, so decode always recovers exactly the fields encode rendered. Fields are strings and must come from the same element (the same arrays at every wildcard depth). Plain concatenation with one separator is the special case of a template with that separator between placeholders.

Implemented in #54.

Activity

  1. added
    enhancementNew feature or request
    deferredDeliberately not built yet, with a trigger for revisiting
    on Oct 20, 2026
  2. added theissue type on Oct 20, 2026
  3. github-actions commented on Oct 21, 2026

    @github-actions

    🎉 This issue has been resolved in version 0.6.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    deferredDeliberately not built yet, with a trigger for revisitingenhancementNew feature or requestreleased

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions