Skip to content

Commit 7c8aa06

Browse files
feat(schema check): allow configuring context_id on data resource schema_check
1 parent f8a2c9a commit 7c8aa06

3 files changed

Lines changed: 23 additions & 13 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kind: Added
2+
body: Added context_id to data schema check resource, similar to resource
3+
time: 2025-05-13T13:51:18.940026+02:00

docs/data-sources/schema_check.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ data "hive_schema_check" "check" {
3939

4040
- `author` (String) The author of the version
4141
- `commit` (String) The commit or version identifier
42+
- `context_id` (String) Optional context ID to group schema checks together. Manually approved breaking changes will be memorized for schema checks with the same context id.
4243
- `project` (String) The project name
4344
- `target` (String) The target name
4445

internal/provider/data_source_schema_check.go

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ func (r *HiveSchemaCheckDataSource) Metadata(ctx context.Context, req datasource
2727
}
2828

2929
type HiveSchemaCheckDataSourceModel struct {
30-
Service types.String `tfsdk:"service"`
31-
Commit types.String `tfsdk:"commit"`
32-
Author types.String `tfsdk:"author"`
33-
Schema types.String `tfsdk:"schema"`
34-
Id types.String `tfsdk:"id"`
35-
Target types.String `tfsdk:"target"`
36-
Project types.String `tfsdk:"project"`
30+
Service types.String `tfsdk:"service"`
31+
Commit types.String `tfsdk:"commit"`
32+
Author types.String `tfsdk:"author"`
33+
Schema types.String `tfsdk:"schema"`
34+
ContextId types.String `tfsdk:"context_id"`
35+
Id types.String `tfsdk:"id"`
36+
Target types.String `tfsdk:"target"`
37+
Project types.String `tfsdk:"project"`
3738
}
3839

3940
func (d *HiveSchemaCheckDataSource) Schema(ctx context.Context, _req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
@@ -69,6 +70,10 @@ func (d *HiveSchemaCheckDataSource) Schema(ctx context.Context, _req datasource.
6970
Computed: true,
7071
MarkdownDescription: "The resource ID",
7172
},
73+
"context_id": schema.StringAttribute{
74+
MarkdownDescription: "Optional context ID to group schema checks together. Manually approved breaking changes will be memorized for schema checks with the same context id.",
75+
Optional: true,
76+
},
7277
},
7378
}
7479
}
@@ -100,12 +105,13 @@ func (r *HiveSchemaCheckDataSource) Read(ctx context.Context, req datasource.Rea
100105
}
101106

102107
result, err := r.client.SchemaCheck(ctx, &sdk.SchemaCheckInput{
103-
Service: data.Service.ValueString(),
104-
Schema: data.Schema.ValueString(),
105-
Commit: data.Commit.ValueString(),
106-
Author: data.Author.ValueString(),
107-
Target: data.Target.ValueString(),
108-
Project: data.Project.ValueString(),
108+
Service: data.Service.ValueString(),
109+
Schema: data.Schema.ValueString(),
110+
Commit: data.Commit.ValueString(),
111+
Author: data.Author.ValueString(),
112+
Target: data.Target.ValueString(),
113+
Project: data.Project.ValueString(),
114+
ContextId: data.ContextId.ValueString(),
109115
})
110116

111117
if err != nil {

0 commit comments

Comments
 (0)