Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions datasource/attribute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,14 @@ func TestAttributes_Validate(t *testing.T) {
AttributeTypes: schema.ObjectAttributeTypes{
{
Name: "obj_attr_one",
Object: schema.ObjectAttributeTypes{
{
Name: "nested_obj_attr_one",
},
{
Name: "nested_obj_attr_one",
Object: &schema.ObjectType{
AttributeTypes: schema.ObjectAttributeTypes{
{
Name: "nested_obj_attr_one",
},
{
Name: "nested_obj_attr_one",
},
},
},
},
Expand Down
14 changes: 8 additions & 6 deletions provider/attribute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,14 @@ func TestAttributes_Validate(t *testing.T) {
AttributeTypes: schema.ObjectAttributeTypes{
{
Name: "obj_attr_one",
Object: schema.ObjectAttributeTypes{
{
Name: "nested_obj_attr_one",
},
{
Name: "nested_obj_attr_one",
Object: &schema.ObjectType{
AttributeTypes: schema.ObjectAttributeTypes{
{
Name: "nested_obj_attr_one",
},
{
Name: "nested_obj_attr_one",
},
},
},
},
Expand Down
14 changes: 8 additions & 6 deletions resource/attribute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,14 @@ func TestAttributes_Validate(t *testing.T) {
AttributeTypes: schema.ObjectAttributeTypes{
{
Name: "obj_attr_one",
Object: schema.ObjectAttributeTypes{
{
Name: "nested_obj_attr_one",
},
{
Name: "nested_obj_attr_one",
Object: &schema.ObjectType{
AttributeTypes: schema.ObjectAttributeTypes{
{
Name: "nested_obj_attr_one",
},
{
Name: "nested_obj_attr_one",
},
},
},
},
Expand Down
18 changes: 9 additions & 9 deletions schema/element_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
package schema

type ElementType struct {
Bool *BoolType `json:"bool,omitempty"`
Float64 *Float64Type `json:"float64,omitempty"`
Int64 *Int64Type `json:"int64,omitempty"`
List *ListType `json:"list,omitempty"`
Map *MapType `json:"map,omitempty"`
Number *NumberType `json:"number,omitempty"`
Object []ObjectAttributeType `json:"object,omitempty"`
Set *SetType `json:"set,omitempty"`
String *StringType `json:"string,omitempty"`
Bool *BoolType `json:"bool,omitempty"`
Float64 *Float64Type `json:"float64,omitempty"`
Int64 *Int64Type `json:"int64,omitempty"`
List *ListType `json:"list,omitempty"`
Map *MapType `json:"map,omitempty"`
Number *NumberType `json:"number,omitempty"`
Object *ObjectType `json:"object,omitempty"`
Set *SetType `json:"set,omitempty"`
String *StringType `json:"string,omitempty"`
}
20 changes: 10 additions & 10 deletions schema/object_attribute_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import (
type ObjectAttributeType struct {
Name string `json:"name"`

Bool *BoolType `json:"bool,omitempty"`
Float64 *Float64Type `json:"float64,omitempty"`
Int64 *Int64Type `json:"int64,omitempty"`
List *ListType `json:"list,omitempty"`
Map *MapType `json:"map,omitempty"`
Number *NumberType `json:"number,omitempty"`
Object ObjectAttributeTypes `json:"object,omitempty"`
Set *SetType `json:"set,omitempty"`
String *StringType `json:"string,omitempty"`
Bool *BoolType `json:"bool,omitempty"`
Float64 *Float64Type `json:"float64,omitempty"`
Int64 *Int64Type `json:"int64,omitempty"`
List *ListType `json:"list,omitempty"`
Map *MapType `json:"map,omitempty"`
Number *NumberType `json:"number,omitempty"`
Object *ObjectType `json:"object,omitempty"`
Set *SetType `json:"set,omitempty"`
String *StringType `json:"string,omitempty"`
}

type ObjectValidateRequest struct {
Expand All @@ -46,7 +46,7 @@ func (o ObjectAttributeTypes) Validate(ctx context.Context, req ObjectValidateRe
Path: fmt.Sprintf("%s object attribute type %q", req.Path, attributeType.Name),
}

err := attributeType.Object.Validate(ctx, objectValidateRequest)
err := attributeType.Object.AttributeTypes.Validate(ctx, objectValidateRequest)

nestedErrs = errors.Join(nestedErrs, err)
}
Expand Down
11 changes: 11 additions & 0 deletions schema/object_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package schema

type ObjectType struct {
AttributeTypes ObjectAttributeTypes `json:"attribute_types"`

// CustomType is a customization of the ObjectType.
CustomType *CustomType `json:"custom_type,omitempty"`
}
Loading