-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/fwschemadata: Ensure Default implementations receive request…
… Path and have response Diagnostics handled (#780) Reference: #778 This changeset also includes panic prevention for `defaults.List`, `defaults.Map`, and `defaults.Set` implementations which do not return `Diagnostics` or `PlanValue`. Previously before logic update: ``` --- FAIL: TestDataDefault (0.00s) --- FAIL: TestDataDefault/bool-attribute-response-diagnostics (0.00s) /Users/bflad/src/github.com/hashicorp/terraform-plugin-framework/internal/fwschemadata/data_default_test.go:6959: unexpected diagnostics difference: diag.Diagnostics( - nil, + { + diag.ErrorDiagnostic{detail: "test error detail", summary: "test error summary"}, + diag.WarningDiagnostic{detail: "test warning detail", summary: "test warning summary"}, + }, ) --- FAIL: TestDataDefault (0.01s) --- FAIL: TestDataDefault/list-attribute-request-path (0.00s) panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x2 addr=0x30 pc=0x100a161ec] goroutine 14 [running]: testing.tRunner.func1.2({0x1010fe140, 0x10137c890}) /opt/homebrew/Cellar/go/1.20.5/libexec/src/testing/testing.go:1526 +0x1c8 testing.tRunner.func1() /opt/homebrew/Cellar/go/1.20.5/libexec/src/testing/testing.go:1529 +0x384 panic({0x1010fe140, 0x10137c890}) /opt/homebrew/Cellar/go/1.20.5/libexec/src/runtime/panic.go:884 +0x204 github.com/hashicorp/terraform-plugin-framework/types/basetypes.ListValue.ToTerraformValue({{0x0, 0x0, 0x0}, {0x0, 0x0}, 0x0}, {0x101154860, 0x1400009c018}) /Users/bflad/src/github.com/hashicorp/terraform-plugin-framework/types/basetypes/list_value.go:208 +0x5c github.com/hashicorp/terraform-plugin-framework/internal/fwschemadata.(*Data).TransformDefaults.func1(0x140004ecba0?, {{0x101156f08?, 0x14000165530?}, {0x0?, 0x0?}}) /Users/bflad/src/github.com/hashicorp/terraform-plugin-framework/internal/fwschemadata/data_default.go:168 +0x1324 ```
- Loading branch information
Showing
14 changed files
with
2,077 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: BUG FIXES | ||
body: 'resource/schema: Ensured `Default` implementations received request `Path` | ||
and have response `Diagnostics` handled' | ||
time: 2023-06-16T14:07:18.774874-04:00 | ||
custom: | ||
Issue: "778" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: BUG FIXES | ||
body: 'resource/schema: Prevented panics with `Default` implementations on list, map, | ||
and set where no response `Diagnostics` or `PlanValue` was returned' | ||
time: 2023-06-16T14:08:34.806147-04:00 | ||
custom: | ||
Issue: "778" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.