Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(parser): support ref-tags with default values #11

Closed
wants to merge 0 commits into from

Conversation

MatteoVoges
Copy link

@MatteoVoges MatteoVoges commented Mar 20, 2023

Proposed Changes

  • Added support for specifying default values for non existing keys / dictionary-paths
  • Extended functionality to support a reference-tag as default value, e.g. ${spec:value||${default:value||another-default}}
  • Use || as delimiter, because it fits well in the kapitan ecosystem

Examples

parameters:
  existing:
    key: myvalue

  foo: ${non:existing:key||bar} # --> bar (default value)
  mykey: ${existing:key||bar} # --> myvalue (value exists)
parameters:
  defaults:  
    default1: myDefault

  spec:
    spec1: ${not:existing||${defaults:default1}} # --> myDefault (tag in default-value exists)
    spec2: ${not:existing||${defaults:notfound||fallback}} # --> fallback (tag in default-value not exists, default gets taken) 

Breaking changes

  • You should not have the || - delimiter in your yaml-keys anymore!

To Do

  • Add tests
  • Add documentation (also in kapitan docs)
    @ademariag Where should this be done?

Contributed by

@MatteoVoges MatteoVoges marked this pull request as ready for review March 21, 2023 10:35
@MatteoVoges MatteoVoges force-pushed the develop branch 2 times, most recently from 95f2f70 to 2f9f2ac Compare March 22, 2023 10:20
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.

None yet

1 participant