carvel-dev / carvel-dev/ytt

Support default value for `any` type

Open
#883 6 comments 0 reactions 1 assignee Claimed by @prembhaskal View on GitHub
question
Dominant language
Go
Stars
1.9k
Forks
167
PR merge metrics
No merged PRs in 30d

Description

**Describe the problem/challenge you have**

I want set the default value for `any` type but I can't.

Here is the example.

- schema.yaml

```yaml
#@data/values-schema
---
test:
#@schema/type any=True
optional_config:
param1: "a"
param2: "b"
```

- template.yaml

```yaml
#@ load("@ytt:data", "data")

conf: #@ data.values.test.optional_config
```

- value.yaml

```yaml
#@data/values
---
test:
optional_config:
param3: "c"

```

```shell
$ ytt -f value.yaml -f schema.yaml -f template.yaml
ytt: Error: Overlaying data values (in following order: value.yaml):
Document on line value.yaml:2:
Map item (key 'test') on line value.yaml:3:
Map item (key 'optional_config') on line value.yaml:4:
Map item (key 'param3') on line value.yaml:5:
Expected number of matched nodes to be 1, but was 0
```

**Describe the solution you'd like**

In the example, the expected output is:

```yaml
conf:
param1: a
param2: b
param3: c
```

I hope this is supported 🙏

Or I would be glad if you could share the workarounds for this 🙇‍♂️

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

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.