carvel-dev / ytt

YAML templating tool that works on YAML structure instead of text
https://carvel.dev/ytt
Apache License 2.0
1.66k stars 135 forks source link

"null" data values erroneously passes schema check #566

Open pivotaljohn opened 2 years ago

pivotaljohn commented 2 years ago

What steps did you take:

With these files...

#@data/values-schema
---
gotta_have_this_key: true
#@data/values
---
#@ 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...

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:

Environment:


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.

pivotaljohn commented 2 years ago

Fixing this bug takes a behavior that was succeeding and now causes an error. This is technically a breaking change.

That said, relying on this behavior has the effect of creating a false positive. Breaks that occur from this fix will reveal potential issues that had not yet surfaced (or created enough damage to be noticed).