Skip to content

feat: add hasField and getFieldOrDefault template functions#635

Draft
nutellinoit wants to merge 1 commit intomainfrom
feat/add-hasfield-and-getfieldordefault-functions
Draft

feat: add hasField and getFieldOrDefault template functions#635
nutellinoit wants to merge 1 commit intomainfrom
feat/add-hasfield-and-getfieldordefault-functions

Conversation

@nutellinoit
Copy link
Copy Markdown
Member

@nutellinoit nutellinoit commented Nov 6, 2025

Summary 💡

This PR adds hasField and getFieldOrDefault template helper functions to eliminate complex nested conditionals in distribution templates. These functions use dot-notation paths (e.g., "spec.distribution.modules.aws.ebsCsiDriver.overrides.iamRoleName") to safely check nested field existence and retrieve values with defaults. Includes 56 comprehensive unit tests covering edge cases, nil handling, and type safety. Released in v0.33.2-rc.2

Tests performed 🧪

  • Unit testing
  • Tested e2e in the distribution project with modified templates

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.

1 participant