Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default values (again!!) #1003

Open
Zirbo opened this issue Nov 17, 2023 · 3 comments
Open

Default values (again!!) #1003

Zirbo opened this issue Nov 17, 2023 · 3 comments

Comments

@Zirbo
Copy link

Zirbo commented Nov 17, 2023

Hallo,
I know this has been mentioned plenty of times (#462, #165 (comment) and so on) and that you can implement UnmarshalYAML to set your own defaults.
Buuuuuut if you have multiple types of configs, and in each of them just a single field needs a default, implementing UnmarshalYAML in each of them makes your code quite bloated. It really seems complexity that could be hidden in the library itself.
Is something like

type Config struct {
    A string  `string_name, omitempty, default="abc"`
    B int       `int_name, omitempty, default=10`
    C bool    `bool_name, omitempty, default=true`
}

in the roadmap? Or is there some deeper reason (I mean in the code) for this missing feature so it will never be implemented?

@rew1nter
Copy link

rew1nter commented Dec 4, 2023

This would be so nice

@fishjam
Copy link

fishjam commented Jan 5, 2024

I want this feature too.
but seems this project is no longer maintained, there are already 100+ PR pending :(

@MeNsaaH
Copy link

MeNsaaH commented Jan 18, 2024

I believe this fork has been created by k8s maintainers and would can serve for now: kubernetes-sigs/yaml#76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants