@@ -6,14 +6,14 @@ package identityschema_test
66import (
77 "context"
88 "fmt"
9+ "github.com/hashicorp/terraform-plugin-framework/diag"
910 "strings"
1011 "testing"
1112
1213 "github.com/google/go-cmp/cmp"
1314 "github.com/hashicorp/terraform-plugin-go/tftypes"
1415
1516 "github.com/hashicorp/terraform-plugin-framework/attr"
16- "github.com/hashicorp/terraform-plugin-framework/diag"
1717 "github.com/hashicorp/terraform-plugin-framework/internal/fwschema"
1818 "github.com/hashicorp/terraform-plugin-framework/internal/testing/testschema"
1919 "github.com/hashicorp/terraform-plugin-framework/internal/testing/testtypes"
@@ -480,6 +480,132 @@ func TestListAttributeValidateImplementation(t *testing.T) {
480480 },
481481 },
482482 },
483+ "elementtype-bool" : {
484+ attribute : identityschema.ListAttribute {
485+ RequiredForImport : true ,
486+ ElementType : types .BoolType ,
487+ },
488+ request : fwschema.ValidateImplementationRequest {
489+ Name : "test" ,
490+ Path : path .Root ("test" ),
491+ },
492+ expected : & fwschema.ValidateImplementationResponse {},
493+ },
494+ "elementtype-int64" : {
495+ attribute : identityschema.ListAttribute {
496+ RequiredForImport : true ,
497+ ElementType : types .Int64Type ,
498+ },
499+ request : fwschema.ValidateImplementationRequest {
500+ Name : "test" ,
501+ Path : path .Root ("test" ),
502+ },
503+ expected : & fwschema.ValidateImplementationResponse {},
504+ },
505+ "elementtype-int32" : {
506+ attribute : identityschema.ListAttribute {
507+ RequiredForImport : true ,
508+ ElementType : types .Int32Type ,
509+ },
510+ request : fwschema.ValidateImplementationRequest {
511+ Name : "test" ,
512+ Path : path .Root ("test" ),
513+ },
514+ expected : & fwschema.ValidateImplementationResponse {},
515+ },
516+ "elementtype-float64" : {
517+ attribute : identityschema.ListAttribute {
518+ RequiredForImport : true ,
519+ ElementType : types .Float64Type ,
520+ },
521+ request : fwschema.ValidateImplementationRequest {
522+ Name : "test" ,
523+ Path : path .Root ("test" ),
524+ },
525+ expected : & fwschema.ValidateImplementationResponse {},
526+ },
527+ "elementtype-float32" : {
528+ attribute : identityschema.ListAttribute {
529+ RequiredForImport : true ,
530+ ElementType : types .Float32Type ,
531+ },
532+ request : fwschema.ValidateImplementationRequest {
533+ Name : "test" ,
534+ Path : path .Root ("test" ),
535+ },
536+ expected : & fwschema.ValidateImplementationResponse {},
537+ },
538+ "elementtype-number" : {
539+ attribute : identityschema.ListAttribute {
540+ RequiredForImport : true ,
541+ ElementType : types .NumberType ,
542+ },
543+ request : fwschema.ValidateImplementationRequest {
544+ Name : "test" ,
545+ Path : path .Root ("test" ),
546+ },
547+ expected : & fwschema.ValidateImplementationResponse {},
548+ },
549+ "elementtype-notprimitive-dynamic" : {
550+ attribute : identityschema.ListAttribute {
551+ RequiredForImport : true ,
552+ ElementType : types .DynamicType ,
553+ },
554+ request : fwschema.ValidateImplementationRequest {
555+ Name : "test" ,
556+ Path : path .Root ("test" ),
557+ },
558+ expected : & fwschema.ValidateImplementationResponse {
559+ Diagnostics : diag.Diagnostics {
560+ diag .NewErrorDiagnostic (
561+ "Invalid Attribute Implementation" ,
562+ "When validating the schema, an implementation issue was found. " +
563+ "This is always an issue with the provider and should be reported to the provider developers.\n \n " +
564+ fmt .Sprintf ("\" test\" contains an Attribute type that is not allowed for Resource Identity. " ),
565+ ),
566+ },
567+ },
568+ },
569+ "elementtype-notprimitive-object" : {
570+ attribute : identityschema.ListAttribute {
571+ RequiredForImport : true ,
572+ ElementType : types.ObjectType {},
573+ },
574+ request : fwschema.ValidateImplementationRequest {
575+ Name : "test" ,
576+ Path : path .Root ("test" ),
577+ },
578+ expected : & fwschema.ValidateImplementationResponse {
579+ Diagnostics : diag.Diagnostics {
580+ diag .NewErrorDiagnostic (
581+ "Invalid Attribute Implementation" ,
582+ "When validating the schema, an implementation issue was found. " +
583+ "This is always an issue with the provider and should be reported to the provider developers.\n \n " +
584+ fmt .Sprintf ("\" test\" contains an Attribute type that is not allowed for Resource Identity. " ),
585+ ),
586+ },
587+ },
588+ },
589+ "elementtype-notprimitive-map" : {
590+ attribute : identityschema.ListAttribute {
591+ RequiredForImport : true ,
592+ ElementType : types.MapType {},
593+ },
594+ request : fwschema.ValidateImplementationRequest {
595+ Name : "test" ,
596+ Path : path .Root ("test" ),
597+ },
598+ expected : & fwschema.ValidateImplementationResponse {
599+ Diagnostics : diag.Diagnostics {
600+ diag .NewErrorDiagnostic (
601+ "Invalid Attribute Implementation" ,
602+ "When validating the schema, an implementation issue was found. " +
603+ "This is always an issue with the provider and should be reported to the provider developers.\n \n " +
604+ fmt .Sprintf ("\" test\" contains an Attribute type that is not allowed for Resource Identity. " ),
605+ ),
606+ },
607+ },
608+ },
483609 }
484610
485611 for name , testCase := range testCases {
0 commit comments