carvel-dev / carvel-dev/ytt

"null" data values erroneously passes schema check

Open
#566 1 comment 1 reaction 0 assignees View on GitHub
breaking change bug priority/unprioritized-backlog
Dominant language
Go
Stars
1.9k
Forks
167
PR merge metrics
No merged PRs in 30d

Description

**What steps did you take:**

With these files...
```yaml
#@data/values-schema
---
gotta_have_this_key: true
```

```yaml
#@data/values
---
```

```yaml
#@ load("@ytt:data", "data")
---
data.values: #@ data.values
```
.. ran this ...
```
$ ytt -f .
```

**What happened:**
```
data.values: null
```

**What did you expect:**
I expected to see a schema error message, like...

```console
ytt: Error: Overlaying data values (in following order: values.yml):
One or more data values were invalid
====================================

values.yml:
|
2 | ---
|

= found: null
= expected: map (by schema.yml:2)
```

**Anything else you would like to add:**

- Fixing this bug would be a breaking change: it's turns what is currently a "successful" result and error outcome.
- This behavior is being used as part of a workaround for situations like #563.
- For this reason, this fix ought to be fixed _after_ implementing #418.

**Environment:**

- ytt version (use `ytt --version`): v0.38.0

---
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.

Contributor guide

Open the contributing guide

Research direction

Reproduce the case with the schema, data-values, and template snippets by running `ytt -f .`, then trace the data-values schema check that accepts the null result. Compare the observed output with the expected schema error and account for the dependency on #418 and the workaround described for #563. Done means invalid null data values produce the documented schema error without breaking the intended follow-up behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.