Skip to content

Allow configuring struct tag keys per engine #60

Description

@abemedia

Problem

Struct field lookup currently uses the liquid struct tag. Callers sometimes need to render types from other packages that already use tags such as json and cannot be modified.

Proposed direction

Make struct-tag lookup configurable on an Engine or render configuration instance, with liquid as the default. Do not expose a mutable package-global variable: separate engines can render concurrently with different policies, and a global setting would introduce races and cross-request behavior changes.

Possible APIs include setting an ordered list of tag keys (for example, liquid then json) or installing a field-name resolver. The design should specify how empty names, -, options such as omitempty, embedded fields, and duplicate names are handled.

Acceptance criteria

  • Existing behavior remains the default.
  • Configuration is scoped to an engine/render configuration.
  • Two engines with different tag policies can render concurrently.
  • Tests cover liquid, json, ignored fields, embedded structs, and conflicts.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions