carvel-dev / carvel-dev/ytt

Should YAML nodes included through a merge operation `<<` or anchor reference `&` have updated line numbers.

Open
#239 1 comment 0 reactions 0 assignees View on GitHub
discussion
Dominant language
Go
Stars
1.9k
Forks
167
PR merge metrics
No merged PRs in 30d

Description

Consider this fragment:

```yaml
seq1: &tag
- 1
- 2

seq2: *tag
```

Running this through ytt returns: (the expected parsed YAML)
```yaml
seq1:
- 1
- 2
seq2:
- 1
- 2
```

As we've started to introduce schemas, a situation could arise where a legal value in one place becomes unacceptable in another. For example, consider a schema validation that says "all entries in seq2 are greater than 10". This is obviously a broken contract, so how can we alert the user that validation has failed?

One of the more useful debugging tools is showing line numbers so that the user knows where to go to correct the error. In this scenario, which line numbers should we show? The original "anchored" location? The location of the "reference" point?
Should we treat the merge/anchor actions as if their operations had already completed?
Should we update other line numbers below the merged content?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.