[Question]::Can we replace and Remove yaml keys with single configuration ?
- Dominant language
- Go
- Stars
- 1.9k
- Forks
- 167
- PR merge metrics
- No merged PRs in 30d
Description
Hi Team,
This question might seem very basic, but i am a new user of `ytt` and still in exploration mode.
I have following templates.
**Base Template:**
```
`---
apiVersion: 1
specification:
versions:
- name: v1
schema:
openAPIV3Schema:
properties:
spec:
myConfiguration:
description: Customized Configuration
`
```
**Key Replace Template:**
```
`
#@ load("@ytt:overlay", "overlay")
#@ load("@ytt:data", "data")
#@overlay/match by=overlay.all
---
apiVersion: 1
specification:
versions:
#@overlay/match by=overlay.all, expects="1+"
- schema:
#@overlay/replace via=lambda left, right: {"properties": right}
openAPIV3Schema:
spec:
new_myConfiguration:
#@overlay/replace via=lambda left, right: {"properties": right}
new_description: Modified Configuration
new_key: avinash
`
```
**Key_Remove_Template:**
```
#@ load("@ytt:overlay", "overlay")
#@ load("@ytt:data", "data")
#@overlay/match by=overlay.all
---
apiVersion: 1
specification:
versions:
#@overlay/match by=overlay.all, missing_ok=True
- schema:
openAPIV3Schema:
properties:
spec:
#@overlay/match when=lambda right: data.values.client == "local_client"
#@overlay/remove
new_myConfiguration:
```
So basically i am trying to rename `myConfiguration` provided `client !="local_client"`, and if then remove `myConfiguration` altogether.
Contributor guide
Research direction
Reproduce the Base Template, Key Replace Template, and Key_Remove_Template with ytt, focusing on the overlay annotations and the client condition shown in the issue. Compare the rendered YAML for local_client and other clients, then determine whether one configuration can produce the requested rename and removal behavior. Done means the conditional outputs match the described result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- yaml
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100