Define Body.JustAttributes as returning Attributes
This was missed when updating the previous direct references to map[string]*Attribute.
This commit is contained in:
parent
e765ff422a
commit
c5df265cd0
@ -125,7 +125,7 @@ func (b *body) PartialContent(schema *zcl.BodySchema) (*zcl.BodyContent, zcl.Bod
|
||||
|
||||
// JustAttributes for JSON bodies interprets all properties of the wrapped
|
||||
// JSON object as attributes and returns them.
|
||||
func (b *body) JustAttributes() (map[string]*zcl.Attribute, zcl.Diagnostics) {
|
||||
func (b *body) JustAttributes() (zcl.Attributes, zcl.Diagnostics) {
|
||||
attrs := make(map[string]*zcl.Attribute)
|
||||
for name, jsonAttr := range b.obj.Attrs {
|
||||
if _, hidden := b.hiddenAttrs[name]; hidden {
|
||||
|
@ -629,7 +629,7 @@ func TestJustAttributes(t *testing.T) {
|
||||
// this test focuses on the handling of extraneous attributes.
|
||||
tests := []struct {
|
||||
src string
|
||||
want map[string]*zcl.Attribute
|
||||
want zcl.Attributes
|
||||
}{
|
||||
{
|
||||
`{}`,
|
||||
|
@ -93,7 +93,7 @@ func (mb mergedBodies) PartialContent(schema *BodySchema) (*BodyContent, Body, D
|
||||
return mb.mergedContent(schema, true)
|
||||
}
|
||||
|
||||
func (mb mergedBodies) JustAttributes() (map[string]*Attribute, Diagnostics) {
|
||||
func (mb mergedBodies) JustAttributes() (Attributes, Diagnostics) {
|
||||
attrs := make(map[string]*Attribute)
|
||||
var diags Diagnostics
|
||||
|
||||
|
@ -412,7 +412,7 @@ func (v *testMergedBodiesVictim) PartialContent(schema *BodySchema) (*BodyConten
|
||||
return content, emptyBody, diags
|
||||
}
|
||||
|
||||
func (v *testMergedBodiesVictim) JustAttributes() (map[string]*Attribute, Diagnostics) {
|
||||
func (v *testMergedBodiesVictim) JustAttributes() (Attributes, Diagnostics) {
|
||||
attrs := make(map[string]*Attribute)
|
||||
|
||||
rng := Range{
|
||||
|
@ -63,7 +63,7 @@ type Body interface {
|
||||
//
|
||||
// Diagnostics may be produced for other reasons too, such as duplicate
|
||||
// declarations of the same attribute.
|
||||
JustAttributes() (map[string]*Attribute, Diagnostics)
|
||||
JustAttributes() (Attributes, Diagnostics)
|
||||
|
||||
// MissingItemRange returns a range that represents where a missing item
|
||||
// might hypothetically be inserted. This is used when producing
|
||||
|
Loading…
Reference in New Issue
Block a user