carvel-dev / carvel-dev/ytt

Return an error (rather than panic'ing) when a non-serializable user input is provided for `@schema/default`

Open
#507 0 comments 0 reactions 0 assignees View on GitHub
enhancement priority/unprioritized-backlog snack
Dominant language
Go
Stars
1.9k
Forks
167
PR merge metrics
No merged PRs in 30d

Description

src: https://github.com/vmware-tanzu/carvel-ytt/pull/490

- today, we generally panic when someone includes a function value (i.e. lambda) in the YAML structure. Ideally, we would _error_ when it’s anticipated bad user input and _panic_ when it is the result of `ytt` coding error. ([example](https://github.com/vmware-tanzu/carvel-ytt/pull/490/files#diff-3cd3d8e2686249d524141b98b510ce20456b45eb99a8a1b082ebbd77602d862dR129))

repro example:
```
#@data/values-schema
---
nothing: "something"
#@schema/default lambda: "hellop"
string: ""
```

`ytt -f .`

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the provided example with `ytt -f .`, then inspect the implementation and tests changed or referenced by pull request 490. The work is done when a non-serializable function value supplied through `@schema/default` reports an error for bad user input instead of panicking, while genuine ytt coding errors can still panic.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.