From 4fcad1f4938ad3c2e466023d3e0e166ea6b68a84 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Sun, 21 May 2017 09:46:50 -0700 Subject: [PATCH] json: Respect hiddenAttrs in JustAttributes Previously it was leaking out hidden attributes. --- zcl/json/structure.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zcl/json/structure.go b/zcl/json/structure.go index 0b39861..44ab337 100644 --- a/zcl/json/structure.go +++ b/zcl/json/structure.go @@ -128,6 +128,9 @@ func (b *body) PartialContent(schema *zcl.BodySchema) (*zcl.BodyContent, zcl.Bod func (b *body) JustAttributes() (map[string]*zcl.Attribute, zcl.Diagnostics) { attrs := make(map[string]*zcl.Attribute) for name, jsonAttr := range b.obj.Attrs { + if _, hidden := b.hiddenAttrs[name]; hidden { + continue + } attrs[name] = &zcl.Attribute{ Name: name, Expr: &expression{src: jsonAttr.Value},