Skip to content

Allow the default filter value to be omitted - #1346

Open
PHJ2000 wants to merge 1 commit into
HubSpot:masterfrom
PHJ2000:fix-default-filter-optional-value
Open

PHJ2000 wants to merge 1 commit into
HubSpot:masterfrom
PHJ2000:fix-default-filter-optional-value

Conversation

@PHJ2000

@PHJ2000 PHJ2000 commented Oct 22, 2026

Copy link
Copy Markdown

Using {{ 'a' | default }} currently raises a missing-argument error. Make default_value optional and use an empty string when omitted, as specified by Jinja's default filter.

The fallback uses getOrDefault, so an explicitly supplied null keeps its existing behavior. The obsolete minimum-argument check is removed, and the parameter documentation describes the fallback.

Four regression tests cover defined values, undefined values, truthy=True, and the d alias. All four fail before the production change; existing explicit-null tests continue to pass.

Fixes #1339.

Validation on JDK 21, with a local Maven toolchains file pointing to the installed JDK:

  • mvn -B -ntp -t ../evidence/maven-toolchains.xml -Dproject.build.jdk.version=21 verify: successful, 2,242 tests, 0 failures/errors, 23 existing skips.
  • The build's formatting, Checkstyle, SpotBugs, PMD, and dependency checks passed.
  • git diff --check: passed.

Signed-off-by: Jaehong Park <105151063+PHJ2000@users.noreply.github.com>
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.

default filter requires an explicit argument and fails without one

1 participant