From c6aa7d288c2043a7fa8e4b2bc05afad98d3e3b91 Mon Sep 17 00:00:00 2001 From: bryanl <bryanliles@gmail.com> Date: Thu, 8 Mar 2018 08:38:14 -0500 Subject: [PATCH] bug: mapContainer extension typo Signed-off-by: bryanl <bryanliles@gmail.com> --- Gopkg.lock | 4 +- Gopkg.toml | 2 +- .../ksonnet-gen/ksonnet/catalog.go | 2 +- .../ksonnet-gen/ksonnet/extension.go | 2 +- .../ksonnet-gen/ksonnet/properties.go | 2 +- .../ksonnet-gen/nodemaker/nodemaker.go | 38 +++++++++++++++++-- 6 files changed, 40 insertions(+), 10 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index cde22f63..db95e05a 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -232,7 +232,7 @@ "ksonnet-gen/nodemaker", "ksonnet-gen/printer" ] - revision = "b13dc1c505011ee838ae45324994dac432233000" + revision = "9f27c242ff65da0620f8324cc0cd50c8ef00bf5b" [[projects]] branch = "master" @@ -610,6 +610,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "e99bb34d06691779ec855657a6aa077e80428aee4db1141c5849a84420033170" + inputs-digest = "0b7cc9568e8af03ad2c4e3b5febdef644b40057c6c01aced232c101df726ca4e" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 5899b546..70fa4ae7 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -54,7 +54,7 @@ [[constraint]] name = "github.com/ksonnet/ksonnet-lib" - revision = "b13dc1c505011ee838ae45324994dac432233000" + revision = "9f27c242ff65da0620f8324cc0cd50c8ef00bf5b" [[constraint]] name = "github.com/mattn/go-isatty" diff --git a/vendor/github.com/ksonnet/ksonnet-lib/ksonnet-gen/ksonnet/catalog.go b/vendor/github.com/ksonnet/ksonnet-lib/ksonnet-gen/ksonnet/catalog.go index 29aa34d1..de81258b 100644 --- a/vendor/github.com/ksonnet/ksonnet-lib/ksonnet-gen/ksonnet/catalog.go +++ b/vendor/github.com/ksonnet/ksonnet-lib/ksonnet-gen/ksonnet/catalog.go @@ -152,7 +152,7 @@ func (c *Catalog) Fields() ([]Field, error) { return nil, errors.Wrapf(err, "parse description for %s", name) } - // If there is a path, this should ot be a hidden object. This + // If there is a path, this should not be a hidden object. This // makes this schema a field. if _, ok := c.paths[name]; ok { continue diff --git a/vendor/github.com/ksonnet/ksonnet-lib/ksonnet-gen/ksonnet/extension.go b/vendor/github.com/ksonnet/ksonnet-lib/ksonnet-gen/ksonnet/extension.go index 18fef747..63f471a0 100644 --- a/vendor/github.com/ksonnet/ksonnet-lib/ksonnet-gen/ksonnet/extension.go +++ b/vendor/github.com/ksonnet/ksonnet-lib/ksonnet-gen/ksonnet/extension.go @@ -275,7 +275,7 @@ func setArray(varName string) *nm.Conditional { } func genIsIntersection(a, b nm.Noder) *nm.Binary { - intersection := nm.ApplyCall("std.Inter", a, b) + intersection := nm.ApplyCall("std.setInter", a, b) checkLen := nm.ApplyCall("std.length", intersection) return nm.NewBinary( diff --git a/vendor/github.com/ksonnet/ksonnet-lib/ksonnet-gen/ksonnet/properties.go b/vendor/github.com/ksonnet/ksonnet-lib/ksonnet-gen/ksonnet/properties.go index f69a929f..37fed84b 100644 --- a/vendor/github.com/ksonnet/ksonnet-lib/ksonnet-gen/ksonnet/properties.go +++ b/vendor/github.com/ksonnet/ksonnet-lib/ksonnet-gen/ksonnet/properties.go @@ -74,7 +74,7 @@ func isSkippedProperty(name string, schema spec.Schema) bool { return true } - if strings.Contains(strings.ToLower(schema.Description), "read-only") { + if strings.Contains(strings.ToLower(schema.Description), "read-only") && name != "readOnly" { return true } diff --git a/vendor/github.com/ksonnet/ksonnet-lib/ksonnet-gen/nodemaker/nodemaker.go b/vendor/github.com/ksonnet/ksonnet-lib/ksonnet-gen/nodemaker/nodemaker.go index 6c6f33fd..3041c836 100644 --- a/vendor/github.com/ksonnet/ksonnet-lib/ksonnet-gen/nodemaker/nodemaker.go +++ b/vendor/github.com/ksonnet/ksonnet-lib/ksonnet-gen/nodemaker/nodemaker.go @@ -87,6 +87,13 @@ func KVFromMap(m map[string]interface{}) (*Object, error) { return nil, err } + o.Set(InheritedKey(name), child) + case map[string]interface{}: + child, err := KVFromMap(t) + if err != nil { + return nil, err + } + o.Set(InheritedKey(name), child) default: return nil, errors.Errorf("unsupported type %T", t) @@ -179,6 +186,10 @@ func (o *Object) Keys() []Key { return keys } +var ( + reField = regexp.MustCompile(`^[A-Za-z]+[A-Za-z0-9]*$`) +) + // Node converts the object to a jsonnet node. func (o *Object) Node() ast.Node { ao := &astext.Object{ @@ -193,12 +204,21 @@ func (o *Object) Node() ast.Node { Comment: o.generateComment(k.comment), } - if k.category == ast.ObjectFieldStr { - of.Expr1 = NewStringDouble(k.name).Node() + if k.category == ast.ObjectLocal { + of.Id = newIdentifier(name) + of.Kind = k.category + } else if stringInSlice(name, jsonnetReservedWords) { + of.Expr1 = NewStringDouble(name).Node() + of.Kind = ast.ObjectFieldStr + } else if reField.MatchString(name) { + id := ast.Identifier(name) + of.Kind = ast.ObjectFieldID + of.Id = &id } else { - of.Id = newIdentifier(k.name) + of.Expr1 = NewStringDouble(name).Node() + of.Kind = ast.ObjectFieldStr } - of.Kind = k.category + of.Hide = k.visibility of.Expr2 = v.Node() of.Method = k.Method() @@ -939,3 +959,13 @@ func newIdentifier(value string) *ast.Identifier { id := ast.Identifier(value) return &id } + +func stringInSlice(s string, sl []string) bool { + for i := range sl { + if sl[i] == s { + return true + } + } + + return false +} -- GitLab