Skip to content

Overlaying list on schema renders incorrectly #912

Open
@henry-spanka

Description

What steps did you take:

I expect b.yaml to append item "var1" to vars list in each app. However the item is appended twice (or more depending on how many items are in apps).

schema.yaml

#@data/values-schema
---
apps:
  - name: ""
    vars:
      - ""

a.yaml

#@data/values
---
apps:
  - name: app1
  - name: app2

b.yaml

#@data/values
#@ load("@ytt:overlay", "overlay")
---
apps:
  #@overlay/match by=overlay.all, expects="1+"
  - vars:
    - var1
ytt -f schema.yaml -f a.yaml -f b.yaml --data-values-inspect

What happened:

"var1" is appended to each vars list twice.

apps:
- name: app1
  vars:
  - var1
  - var1
- name: app2
  vars:
  - var1
  - var1

What did you expect:

"var1" appended once to vars list.

apps:
- name: app1
  vars:
  - var1
- name: app2
  vars:
  - var1

Anything else you would like to add:

Setting vars to an empty list in a.yaml explicitly resolves this issue, however it's not the same semantically (default value from schema file gets lost).

#@data/values
---
apps:
  - name: app1
    vars: []
  - name: app2

Additionally, defining b.yaml as following to only match on name=app1, appends item to every list item (behaving like overlay.all).

#@data/values
#@ load("@ytt:overlay", "overlay")
---
apps:
  #@overlay/match by=overlay.map_key("name"), expects="1+"
  - name: app1
    vars:
    - var1

Environment:

  • ytt version (use ytt --version):
    ytt version 0.49.0
  • OS (e.g. from /etc/os-release):
    macOS 14.4.1 M1

Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

Metadata

Assignees

No one assigned

    Labels

    bugThis issue describes a defect or unexpected behaviordiscussionThis issue is not a bug or feature and a conversation is needed to find an appropriate resolution

    Type

    No type

    Projects

    • Status

      To Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions