json: Respect hiddenAttrs in JustAttributes

Previously it was leaking out hidden attributes.
This commit is contained in:
Martin Atkins 2017-05-21 09:46:50 -07:00
parent a291478c78
commit 4fcad1f493

View File

@ -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},