carvel-dev / carvel-dev/ytt

Functions cannot return yaml scalars and return null instead

Open
#19 8 comments 0 reactions 0 assignees View on GitHub
discussion error msg improvement
Dominant language
Go
Stars
1.9k
Forks
167
PR merge metrics
No merged PRs in 30d

Description

This work:

```yaml
#@ def some_data():
hello: world
#@ end

simple_key: #@ some_data()
```

This does't work

```yaml
#@ def some_data():
"hello"
#@ end

simple_key: #@ some_data()
```

neither this:

```yaml
#@ def some_data():
- hello: world
#@ end

simple_key: #@ some_data()
```

The error is not really understandable either: *Unmarshaling YAML template: yaml: line 2: did not find expected *

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests. Reproduce the three YAML examples through ytt and trace how template function return values are handled; done means scalar and sequence returns are preserved instead of becoming null, with a more understandable error for invalid output.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.