carvel-dev / carvel-dev/ytt

Command to validate a data values file

Open
#278 7 comments 0 reactions 0 assignees View on GitHub
carvel accepted enhancement
Dominant language
Go
Stars
1.9k
Forks
167
PR merge metrics
No merged PRs in 30d

Description

**Describe the problem/challenge you have**
I have a schema file, and data values file, and some ytt templates. I want to run a command to validate that my data values adhere to my schema.

**Describe the solution you'd like**
A command that gives feedback on whether or not my data values adhere to my schema file. If my data values are not compatible with my schema, the command fails and give me hints as to what is incorrect in my data values file.
If the data values are compatible with my schema, then the command succeeds.

**Anything else you would like to add:**
ytt is often used piped into other tools, so some information such as warnings may be lost when running the main ytt command `ytt -f ...`.

This belongs as a separate command `ytt validate` so that the output of the command can provide additional details beyond what would be seen with `ytt -f ..`.
The additional details that `validate` could provide could be warnings when my data values file is compatible with my schema, but the data values are duplicated, or otherwise not recommended. For example:

schema.yml
```
#@schema/definition name="data/values"
foo: "apple"
```
datavalues.yml
```
#@data/values
foo: "apple"
```
I see a warning like: `Warning: data value 'foo' was set to the same value '"apple"' more than once. You may remove this data value`

Contributor guide

Open the contributing guide

Research direction

The issue names no files, tests, or entry points. Start by mapping how ytt currently loads schemas and data values, then define the validate command's scope, diagnostics, exit behavior, and duplicate-value warnings; done requires an agreed design and tests for compatible and incompatible values.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, yaml
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.