@@ -804,6 +804,96 @@ func TestAttributeValidate(t *testing.T) {
804
804
},
805
805
resp : ValidateAttributeResponse {},
806
806
},
807
+ "deprecation-message-known" : {
808
+ req : ValidateAttributeRequest {
809
+ AttributePath : tftypes .NewAttributePath ().WithAttributeName ("test" ),
810
+ Config : Config {
811
+ Raw : tftypes .NewValue (tftypes.Object {
812
+ AttributeTypes : map [string ]tftypes.Type {
813
+ "test" : tftypes .String ,
814
+ },
815
+ }, map [string ]tftypes.Value {
816
+ "test" : tftypes .NewValue (tftypes .String , "testvalue" ),
817
+ }),
818
+ Schema : Schema {
819
+ Attributes : map [string ]Attribute {
820
+ "test" : {
821
+ Type : types .StringType ,
822
+ Optional : true ,
823
+ DeprecationMessage : "Use something else instead." ,
824
+ },
825
+ },
826
+ },
827
+ },
828
+ },
829
+ resp : ValidateAttributeResponse {
830
+ Diagnostics : []* tfprotov6.Diagnostic {
831
+ {
832
+ Severity : tfprotov6 .DiagnosticSeverityWarning ,
833
+ Summary : "Attribute Deprecated" ,
834
+ Detail : "Use something else instead." ,
835
+ Attribute : tftypes .NewAttributePath ().WithAttributeName ("test" ),
836
+ },
837
+ },
838
+ },
839
+ },
840
+ "deprecation-message-null" : {
841
+ req : ValidateAttributeRequest {
842
+ AttributePath : tftypes .NewAttributePath ().WithAttributeName ("test" ),
843
+ Config : Config {
844
+ Raw : tftypes .NewValue (tftypes.Object {
845
+ AttributeTypes : map [string ]tftypes.Type {
846
+ "test" : tftypes .String ,
847
+ },
848
+ }, map [string ]tftypes.Value {
849
+ "test" : tftypes .NewValue (tftypes .String , nil ),
850
+ }),
851
+ Schema : Schema {
852
+ Attributes : map [string ]Attribute {
853
+ "test" : {
854
+ Type : types .StringType ,
855
+ Optional : true ,
856
+ DeprecationMessage : "Use something else instead." ,
857
+ },
858
+ },
859
+ },
860
+ },
861
+ },
862
+ resp : ValidateAttributeResponse {},
863
+ },
864
+ "deprecation-message-unknown" : {
865
+ req : ValidateAttributeRequest {
866
+ AttributePath : tftypes .NewAttributePath ().WithAttributeName ("test" ),
867
+ Config : Config {
868
+ Raw : tftypes .NewValue (tftypes.Object {
869
+ AttributeTypes : map [string ]tftypes.Type {
870
+ "test" : tftypes .String ,
871
+ },
872
+ }, map [string ]tftypes.Value {
873
+ "test" : tftypes .NewValue (tftypes .String , tftypes .UnknownValue ),
874
+ }),
875
+ Schema : Schema {
876
+ Attributes : map [string ]Attribute {
877
+ "test" : {
878
+ Type : types .StringType ,
879
+ Optional : true ,
880
+ DeprecationMessage : "Use something else instead." ,
881
+ },
882
+ },
883
+ },
884
+ },
885
+ },
886
+ resp : ValidateAttributeResponse {
887
+ Diagnostics : []* tfprotov6.Diagnostic {
888
+ {
889
+ Severity : tfprotov6 .DiagnosticSeverityWarning ,
890
+ Summary : "Attribute Deprecated" ,
891
+ Detail : "Use something else instead." ,
892
+ Attribute : tftypes .NewAttributePath ().WithAttributeName ("test" ),
893
+ },
894
+ },
895
+ },
896
+ },
807
897
"warnings" : {
808
898
req : ValidateAttributeRequest {
809
899
AttributePath : tftypes .NewAttributePath ().WithAttributeName ("test" ),
0 commit comments