New ๐ŸŒŠ wave for @helm

Commit 5a1fa107

5a1fa107155bMerged

Sviatoslav Dumchenko <[email protected]> ยท 3 years ago ยท 2 files ยท ~2 modified

Description

fix: update jsonschema for lifecycle

Details

Commit
5a1fa107155b
Parent
788e081406b6

pkg/hooks/config.gomodifiedView file

@@ -23,7 +23,7 @@
2323
2424 type Hooks []Hook
2525
26-func (*Hooks) JSONSchema() *jsonschema.Schema {
26+func (Hooks) JSONSchema() *jsonschema.Schema {
2727 r := &jsonschema.Reflector{
2828 DoNotReference: true,
2929 RequiredFromJSONSchemaTags: true,
@@ -34,12 +34,33 @@
3434 }
3535
3636 type hook struct {
37- Cmd string `yaml:"cmd" json:"cmd" jsonschema:"title=cmd,description=executable to run"`
37+ Cmd string `yaml:"cmd" json:"cmd" jsonschema:"required,title=cmd,description=executable to run"`
3838 Args []string `yaml:"args" json:"args" jsonschema:"title=args,description=arguments to pass to executable"`
3939 Show bool `yaml:"show" json:"show" jsonschema:"title=show,description=whether to log command stdout,default=true"`
4040 AllowFailure bool `yaml:"allow_failure" json:"allow_failure" jsonschema:"title=allow_failure,description=whether to fail the whole helmwave if command fail,default=false"`
4141 }
4242
43+func (hook) JSONSchema() *jsonschema.Schema {
44+ r := &jsonschema.Reflector{
45+ DoNotReference: true,
46+ RequiredFromJSONSchemaTags: true,
47+ }
48+
49+ type values hook
50+ schema := r.Reflect(values{})
51+ schema.OneOf = []*jsonschema.Schema{
52+ {
53+ Type: "string",
54+ },
55+ {
56+ Type: "object",
57+ },
58+ }
59+ schema.Type = ""
60+
61+ return schema
62+}
63+
4364 func (h *hook) Log() *log.Entry {
4465 return log.WithFields(log.Fields{
4566 "cmd": h.Cmd,