Skip to content

#94 - TransformerTrait: allow a list syntax for the transformers option - #255

Merged
njoubert-cleverage merged 1 commit into
mainfrom
94
Oct 9, 2026
Merged

njoubert-cleverage merged 1 commit into
mainfrom
94

Conversation

@njoubert-cleverage

Copy link
Copy Markdown
Member

Description

Fixes #94.

The transformers option of TransformerTrait (TransformerTask, MappingTransformer, ArrayMapTransformer, CachedTransformer, RulesTransformer, generic transformers) also accepts a list, to chain the same transformer without # suffix. Each item is either:

  • a transformer code without options: - trim
  • a map with a single code: options entry: - callback: { callback: array_filter }
transformers:
  - trim
  - callback:
      callback: array_filter
  - callback:
      callback: array_reverse
  • Any other item (integer, empty string, map with several codes...) throws an InvalidArgumentException with its position.
  • In a TransformerException message, a listed transformer is identified by its code followed by # and its position (Transformation 'callback#1' have failed).
  • The map syntax (with # suffixes) is still supported and is not deprecated.

A list was not accepted before (integer keys failed with a TypeError), so this is a pure addition.

Checked end-to-end in process-bundle-demo with a demo.transformer_list process (list in a TransformerTask, in the transformers of a mapped property, and in a generic transformer declared in YAML).

Requirements

  • Documentation updates
    • Reference
    • Cookbooks
    • Changelog
  • Unit tests

Breaking changes

None.

🤖 Generated with Claude Code

…accepts a list, whose items are a transformer code without options or a single code: options map, to chain the same transformer without # suffix

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@njoubert-cleverage
njoubert-cleverage merged commit e4fd697 into main Oct 9, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow iterable syntax for Transformer list

1 participant