/
type.go
30 lines (24 loc) · 1019 Bytes
/
type.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package xattr
import (
"context"
"github.com/hashicorp/terraform-plugin-go/tftypes"
"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-framework/path"
)
// TypeWithValidate extends the attr.Type interface to include a Validate
// method, used to bundle consistent validation logic with the Type.
//
// Deprecated: Use the ValidateableAttribute interface instead for schema
// attribute validation. Use the function.ValidateableParameter interface
// for provider-defined function parameter validation.
type TypeWithValidate interface {
attr.Type
// Validate returns any warnings or errors about the value that is
// being used to populate the Type. It is generally used to check the
// data format and ensure that it complies with the requirements of the
// Type.
Validate(context.Context, tftypes.Value, path.Path) diag.Diagnostics
}