Skip to content

Commit

Permalink
Merge pull request #450 from vmware-tanzu/with-schemas-rename
Browse files Browse the repository at this point in the history
Rename with_schema to with_data_values_schema
  • Loading branch information
pivotaljohn authored Jul 2, 2021
2 parents 1a960d4 + 7857c8e commit f71a1c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pkg/cmd/template/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -2442,7 +2442,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")
Expand Down
12 changes: 6 additions & 6 deletions pkg/workspace/library_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))),
},
}
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit f71a1c1

Please sign in to comment.