|
8 | 8 | "github.com/hashicorp/terraform-plugin-framework/attr" |
9 | 9 | "github.com/hashicorp/terraform-plugin-framework/types" |
10 | 10 | "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/autogen" |
11 | | - "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/autogen/customtype" |
| 11 | + "github.com/mongodb/terraform-provider-mongodbatlas/internal/common/autogen/customtypes" |
12 | 12 | "github.com/stretchr/testify/assert" |
13 | 13 | "github.com/stretchr/testify/require" |
14 | 14 | ) |
@@ -302,39 +302,39 @@ func TestMarshalCustomTypeObject(t *testing.T) { |
302 | 302 | type modelEmptyTest struct{} |
303 | 303 |
|
304 | 304 | type modelCustomTypeTest struct { |
305 | | - AttrPrimitiveOmit types.String `tfsdk:"attr_primitive_omit" autogen:"omitjson"` |
306 | | - AttrObjectOmit customtype.ObjectValue[modelEmptyTest] `tfsdk:"attr_object_omit" autogen:"omitjson"` |
307 | | - AttrObjectOmitUpdate customtype.ObjectValue[modelEmptyTest] `tfsdk:"attr_object_omit_update" autogen:"omitjsonupdate"` |
308 | | - AttrNull customtype.ObjectValue[modelEmptyTest] `tfsdk:"attr_null" autogen:"includenullonupdate"` |
309 | | - AttrInt types.Int64 `tfsdk:"attr_int"` |
310 | | - AttrMANYUpper types.Int64 `tfsdk:"attr_many_upper"` |
| 305 | + AttrPrimitiveOmit types.String `tfsdk:"attr_primitive_omit" autogen:"omitjson"` |
| 306 | + AttrObjectOmit customtypes.ObjectValue[modelEmptyTest] `tfsdk:"attr_object_omit" autogen:"omitjson"` |
| 307 | + AttrObjectOmitUpdate customtypes.ObjectValue[modelEmptyTest] `tfsdk:"attr_object_omit_update" autogen:"omitjsonupdate"` |
| 308 | + AttrNull customtypes.ObjectValue[modelEmptyTest] `tfsdk:"attr_null" autogen:"includenullonupdate"` |
| 309 | + AttrInt types.Int64 `tfsdk:"attr_int"` |
| 310 | + AttrMANYUpper types.Int64 `tfsdk:"attr_many_upper"` |
311 | 311 | } |
312 | 312 |
|
313 | 313 | type modelCustomTypeParentTest struct { |
314 | | - AttrString types.String `tfsdk:"attr_string"` |
315 | | - AttrObject customtype.ObjectValue[modelCustomTypeTest] `tfsdk:"attr_object"` |
| 314 | + AttrString types.String `tfsdk:"attr_string"` |
| 315 | + AttrObject customtypes.ObjectValue[modelCustomTypeTest] `tfsdk:"attr_object"` |
316 | 316 | } |
317 | 317 |
|
318 | | - nullObject := customtype.NewObjectValueNull[modelEmptyTest](ctx) |
319 | | - emptyObject := customtype.NewObjectValue[modelEmptyTest](ctx, modelEmptyTest{}) |
| 318 | + nullObject := customtypes.NewObjectValueNull[modelEmptyTest](ctx) |
| 319 | + emptyObject := customtypes.NewObjectValue[modelEmptyTest](ctx, modelEmptyTest{}) |
320 | 320 |
|
321 | 321 | model := struct { |
322 | | - AttrObjectBasic customtype.ObjectValue[modelCustomTypeTest] `tfsdk:"attr_object_basic"` |
323 | | - AttrObjectNull customtype.ObjectValue[modelCustomTypeTest] `tfsdk:"attr_object_null"` |
324 | | - AttrObjectNested customtype.ObjectValue[modelCustomTypeParentTest] `tfsdk:"attr_object_nested"` |
| 322 | + AttrObjectBasic customtypes.ObjectValue[modelCustomTypeTest] `tfsdk:"attr_object_basic"` |
| 323 | + AttrObjectNull customtypes.ObjectValue[modelCustomTypeTest] `tfsdk:"attr_object_null"` |
| 324 | + AttrObjectNested customtypes.ObjectValue[modelCustomTypeParentTest] `tfsdk:"attr_object_nested"` |
325 | 325 | }{ |
326 | | - AttrObjectBasic: customtype.NewObjectValue[modelCustomTypeTest](ctx, modelCustomTypeTest{ |
| 326 | + AttrObjectBasic: customtypes.NewObjectValue[modelCustomTypeTest](ctx, modelCustomTypeTest{ |
327 | 327 | AttrInt: types.Int64Value(1), |
328 | 328 | AttrPrimitiveOmit: types.StringValue("omitted"), |
329 | 329 | AttrObjectOmit: emptyObject, |
330 | 330 | AttrObjectOmitUpdate: emptyObject, |
331 | 331 | AttrNull: nullObject, |
332 | 332 | AttrMANYUpper: types.Int64Value(2), |
333 | 333 | }), |
334 | | - AttrObjectNull: customtype.NewObjectValueNull[modelCustomTypeTest](ctx), |
335 | | - AttrObjectNested: customtype.NewObjectValue[modelCustomTypeParentTest](ctx, modelCustomTypeParentTest{ |
| 334 | + AttrObjectNull: customtypes.NewObjectValueNull[modelCustomTypeTest](ctx), |
| 335 | + AttrObjectNested: customtypes.NewObjectValue[modelCustomTypeParentTest](ctx, modelCustomTypeParentTest{ |
336 | 336 | AttrString: types.StringValue("parent"), |
337 | | - AttrObject: customtype.NewObjectValue[modelCustomTypeTest](ctx, modelCustomTypeTest{ |
| 337 | + AttrObject: customtypes.NewObjectValue[modelCustomTypeTest](ctx, modelCustomTypeTest{ |
338 | 338 | AttrInt: types.Int64Value(2), |
339 | 339 | AttrPrimitiveOmit: types.StringValue("omitted"), |
340 | 340 | AttrObjectOmit: emptyObject, |
@@ -398,40 +398,40 @@ func TestMarshalCustomTypeNestedList(t *testing.T) { |
398 | 398 | } |
399 | 399 |
|
400 | 400 | type modelNestedListItem struct { |
401 | | - AttrOmit customtype.NestedListValue[modelEmptyTest] `tfsdk:"attr_omit" autogen:"omitjson"` |
402 | | - AttrOmitUpdate customtype.NestedListValue[modelEmptyTest] `tfsdk:"attr_omit_update" autogen:"omitjsonupdate"` |
403 | | - AttrPrimitive types.String `tfsdk:"attr_primitive"` |
404 | | - AttrObject customtype.ObjectValue[modelNestedObject] `tfsdk:"attr_object"` |
405 | | - AttrMANYUpper types.Int64 `tfsdk:"attr_many_upper"` |
| 401 | + AttrOmit customtypes.NestedListValue[modelEmptyTest] `tfsdk:"attr_omit" autogen:"omitjson"` |
| 402 | + AttrOmitUpdate customtypes.NestedListValue[modelEmptyTest] `tfsdk:"attr_omit_update" autogen:"omitjsonupdate"` |
| 403 | + AttrPrimitive types.String `tfsdk:"attr_primitive"` |
| 404 | + AttrObject customtypes.ObjectValue[modelNestedObject] `tfsdk:"attr_object"` |
| 405 | + AttrMANYUpper types.Int64 `tfsdk:"attr_many_upper"` |
406 | 406 | } |
407 | 407 |
|
408 | 408 | model := struct { |
409 | | - AttrNestedList customtype.NestedListValue[modelNestedListItem] `tfsdk:"attr_nested_list"` |
410 | | - AttrNestedListNull customtype.NestedListValue[modelNestedListItem] `tfsdk:"attr_nested_list_null"` |
411 | | - AttrNestedListEmpty customtype.NestedListValue[modelNestedListItem] `tfsdk:"attr_nested_list_empty"` |
| 409 | + AttrNestedList customtypes.NestedListValue[modelNestedListItem] `tfsdk:"attr_nested_list"` |
| 410 | + AttrNestedListNull customtypes.NestedListValue[modelNestedListItem] `tfsdk:"attr_nested_list_null"` |
| 411 | + AttrNestedListEmpty customtypes.NestedListValue[modelNestedListItem] `tfsdk:"attr_nested_list_empty"` |
412 | 412 | }{ |
413 | | - AttrNestedList: customtype.NewNestedListValue[modelNestedListItem](ctx, []modelNestedListItem{ |
| 413 | + AttrNestedList: customtypes.NewNestedListValue[modelNestedListItem](ctx, []modelNestedListItem{ |
414 | 414 | { |
415 | 415 | AttrPrimitive: types.StringValue("string1"), |
416 | 416 | AttrMANYUpper: types.Int64Value(1), |
417 | | - AttrObject: customtype.NewObjectValue[modelNestedObject](ctx, modelNestedObject{ |
| 417 | + AttrObject: customtypes.NewObjectValue[modelNestedObject](ctx, modelNestedObject{ |
418 | 418 | AttrNestedInt: types.Int64Value(2), |
419 | 419 | }), |
420 | | - AttrOmit: customtype.NewNestedListValue[modelEmptyTest](ctx, []modelEmptyTest{}), |
421 | | - AttrOmitUpdate: customtype.NewNestedListValue[modelEmptyTest](ctx, []modelEmptyTest{}), |
| 420 | + AttrOmit: customtypes.NewNestedListValue[modelEmptyTest](ctx, []modelEmptyTest{}), |
| 421 | + AttrOmitUpdate: customtypes.NewNestedListValue[modelEmptyTest](ctx, []modelEmptyTest{}), |
422 | 422 | }, |
423 | 423 | { |
424 | 424 | AttrPrimitive: types.StringValue("string2"), |
425 | 425 | AttrMANYUpper: types.Int64Value(3), |
426 | | - AttrObject: customtype.NewObjectValue[modelNestedObject](ctx, modelNestedObject{ |
| 426 | + AttrObject: customtypes.NewObjectValue[modelNestedObject](ctx, modelNestedObject{ |
427 | 427 | AttrNestedInt: types.Int64Value(4), |
428 | 428 | }), |
429 | | - AttrOmit: customtype.NewNestedListValue[modelEmptyTest](ctx, []modelEmptyTest{}), |
430 | | - AttrOmitUpdate: customtype.NewNestedListValue[modelEmptyTest](ctx, []modelEmptyTest{}), |
| 429 | + AttrOmit: customtypes.NewNestedListValue[modelEmptyTest](ctx, []modelEmptyTest{}), |
| 430 | + AttrOmitUpdate: customtypes.NewNestedListValue[modelEmptyTest](ctx, []modelEmptyTest{}), |
431 | 431 | }, |
432 | 432 | }), |
433 | | - AttrNestedListNull: customtype.NewNestedListValueNull[modelNestedListItem](ctx), |
434 | | - AttrNestedListEmpty: customtype.NewNestedListValue[modelNestedListItem](ctx, []modelNestedListItem{}), |
| 433 | + AttrNestedListNull: customtypes.NewNestedListValueNull[modelNestedListItem](ctx), |
| 434 | + AttrNestedListEmpty: customtypes.NewNestedListValue[modelNestedListItem](ctx, []modelNestedListItem{}), |
435 | 435 | } |
436 | 436 |
|
437 | 437 | const expectedCreateJSON = ` |
|
0 commit comments