Skip to content

Commit

Permalink
Merge pull request #38658 from hashicorp/b/smithy_json_type
Browse files Browse the repository at this point in the history
b/smithy json type expands to any type
  • Loading branch information
johnsonaj authored Aug 2, 2024
2 parents 53bd91a + bcaddc6 commit 00d5f3b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/framework/types/smithy_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (v SmithyJSON[T]) ValueInterface() (T, diag.Diagnostics) {
return zero, diags
}

var data map[string]any
var data any
err := json.Unmarshal([]byte(v.ValueString()), &data)

if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions internal/framework/types/smithy_json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ func TestSmithyJSONValueInterface(t *testing.T) {
},
},
},
"valid SmithyJSON slice": { // lintignore:AWSAT003,AWSAT005
val: fwtypes.SmithyJSONValue[smithyjson.JSONStringer](`["value1","value"]`, newTestJSONDocument), // lintignore:AWSAT003,AWSAT005
expected: &testJSONDocument{
Value: []any{"value1", "value"},
},
},
"invalid SmithyJSON": {
val: fwtypes.SmithyJSONValue[smithyjson.JSONStringer]("not ok", newTestJSONDocument), // lintignore:AWSAT003,AWSAT005
expectError: true,
Expand Down

0 comments on commit 00d5f3b

Please sign in to comment.