From 7857c8eadef4e6f5a8aa08a2cd3581a3f52db1ac Mon Sep 17 00:00:00 2001 From: Garrett Cheadle Date: Thu, 1 Jul 2021 16:20:17 -0700 Subject: [PATCH] Rename with_schema() to with_data_values_schema() --- pkg/cmd/template/schema_test.go | 6 +++--- pkg/workspace/library_module.go | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/cmd/template/schema_test.go b/pkg/cmd/template/schema_test.go index f8860148..71671dd5 100644 --- a/pkg/cmd/template/schema_test.go +++ b/pkg/cmd/template/schema_test.go @@ -617,7 +617,7 @@ rendered: #@ data.values.foo ` cmdOpts.DataValuesFlags = cmdtpl.DataValuesFlags{ EnvFromYAML: []string{"DVS"}, - EnvironFunc: func() []string { return []string{"DVS_foo=not an integer"} }, + EnvironFunc: func() []string { return []string{"DVS_foo=not an integer"} }, } filesToProcess := files.NewSortedFiles([]*files.File{ @@ -1965,7 +1965,7 @@ foo: #@ end #@ libby = library.get("libby") -#@ libby = libby.with_schema(more_schema()) +#@ libby = libby.with_data_values_schema(more_schema()) #@ libby = libby.with_data_values({"foo": {"ree": "set from root"}}) --- #@ template.replace(libby.eval()) @@ -2382,7 +2382,7 @@ someInt: ` + starlarkEvalUsed + expectedInt + ` someString: ` + starlarkEvalUsed + "'" + expectedString + "'" + ` someFloat: ` + starlarkEvalUsed + expectedFloat + ` #@ end ---- #@ template.replace(library.get("lib").with_schema(dvs_from_root()).eval())`) +--- #@ template.replace(library.get("lib").with_data_values_schema(dvs_from_root()).eval())`) libConfigYAML := []byte(` #@ load("@ytt:data", "data") diff --git a/pkg/workspace/library_module.go b/pkg/workspace/library_module.go index 2a25fd33..085ff855 100644 --- a/pkg/workspace/library_module.go +++ b/pkg/workspace/library_module.go @@ -144,11 +144,11 @@ func (l *libraryValue) AsStarlarkValue() starlark.Value { return &starlarkstruct.Module{ Name: "library", Members: starlark.StringDict{ - "with_data_values": starlark.NewBuiltin("library.with_data_values", core.ErrWrapper(l.WithDataValues)), - "with_schema": starlark.NewBuiltin("library.with_schema", core.ErrWrapper(l.WithSchema)), - "eval": starlark.NewBuiltin("library.eval", core.ErrWrapper(core.ErrDescWrapper(evalErrMsg, l.Eval))), - "export": starlark.NewBuiltin("library.export", core.ErrWrapper(core.ErrDescWrapper(exportErrMsg, l.Export))), - "data_values": starlark.NewBuiltin("library.data_values", core.ErrWrapper(core.ErrDescWrapper(exportErrMsg, l.DataValues))), + "with_data_values": starlark.NewBuiltin("library.with_data_values", core.ErrWrapper(l.WithDataValues)), + "with_data_values_schema": starlark.NewBuiltin("library.with_data_values_schema", core.ErrWrapper(l.WithDataValuesSchema)), + "eval": starlark.NewBuiltin("library.eval", core.ErrWrapper(core.ErrDescWrapper(evalErrMsg, l.Eval))), + "export": starlark.NewBuiltin("library.export", core.ErrWrapper(core.ErrDescWrapper(exportErrMsg, l.Export))), + "data_values": starlark.NewBuiltin("library.data_values", core.ErrWrapper(core.ErrDescWrapper(exportErrMsg, l.DataValues))), }, } } @@ -182,7 +182,7 @@ func (l *libraryValue) WithDataValues(thread *starlark.Thread, f *starlark.Built return libVal.AsStarlarkValue(), nil } -func (l *libraryValue) WithSchema(thread *starlark.Thread, f *starlark.Builtin, +func (l *libraryValue) WithDataValuesSchema(thread *starlark.Thread, f *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { if args.Len() != 1 {