internal/provider: Add compilation based interface assertions (#38)
This is a quick method for compilation errors to be raised should the types not satisfy the expected framework interfaces.
This commit is contained in:
		
							parent
							
								
									3c30204856
								
							
						
					
					
						commit
						51deae2bc7
					
				| @ -9,6 +9,10 @@ import ( | ||||
| 	"github.com/hashicorp/terraform-plugin-framework/types" | ||||
| ) | ||||
| 
 | ||||
| // Ensure provider defined types fully satisfy framework interfaces
 | ||||
| var _ tfsdk.DataSourceType = exampleDataSourceType{} | ||||
| var _ tfsdk.DataSource = exampleDataSource{} | ||||
| 
 | ||||
| type exampleDataSourceType struct{} | ||||
| 
 | ||||
| func (t exampleDataSourceType) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagnostics) { | ||||
|  | ||||
| @ -10,6 +10,10 @@ import ( | ||||
| 	"github.com/hashicorp/terraform-plugin-log/tflog" | ||||
| ) | ||||
| 
 | ||||
| // Ensure provider defined types fully satisfy framework interfaces
 | ||||
| var _ tfsdk.ResourceType = exampleResourceType{} | ||||
| var _ tfsdk.Resource = exampleResource{} | ||||
| 
 | ||||
| type exampleResourceType struct{} | ||||
| 
 | ||||
| func (t exampleResourceType) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagnostics) { | ||||
|  | ||||
| @ -9,6 +9,9 @@ import ( | ||||
| 	"github.com/hashicorp/terraform-plugin-framework/types" | ||||
| ) | ||||
| 
 | ||||
| // Ensure provider defined types fully satisfy framework interfaces
 | ||||
| var _ tfsdk.Provider = &provider{} | ||||
| 
 | ||||
| // provider satisfies the tfsdk.Provider interface and usually is included
 | ||||
| // with all Resource and DataSource implementations.
 | ||||
| type provider struct { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Brian Flad
						Brian Flad