Skip to content

Commit 3fe6fb2

Browse files
authored
Replace json.RawMessage for list log messages (#177)
1 parent 739a592 commit 3fe6fb2

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

logging_query.go

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// SPDX-License-Identifier: MPL-2.0
33
package tfjson
44

5-
import "encoding/json"
6-
75
const (
86
MessageListStart LogMessageType = "list_start"
97
MessageListResourceFound LogMessageType = "list_resource_found"
@@ -17,9 +15,9 @@ type ListStartMessage struct {
1715
}
1816

1917
type ListStartData struct {
20-
Address string `json:"address"`
21-
ResourceType string `json:"resource_type"`
22-
InputConfig map[string]json.RawMessage `json:"input_config,omitempty"`
18+
Address string `json:"address"`
19+
ResourceType string `json:"resource_type"`
20+
InputConfig map[string]any `json:"input_config,omitempty"`
2321
}
2422

2523
// ListResourceFoundMessage represents "query" result message of type "list_resource_found"
@@ -29,14 +27,14 @@ type ListResourceFoundMessage struct {
2927
}
3028

3129
type ListResourceFoundData struct {
32-
Address string `json:"address"`
33-
DisplayName string `json:"display_name"`
34-
Identity map[string]json.RawMessage `json:"identity"`
35-
IdentityVersion int64 `json:"identity_version"`
36-
ResourceType string `json:"resource_type"`
37-
ResourceObject map[string]json.RawMessage `json:"resource_object,omitempty"`
38-
Config string `json:"config,omitempty"`
39-
ImportConfig string `json:"import_config,omitempty"`
30+
Address string `json:"address"`
31+
DisplayName string `json:"display_name"`
32+
Identity map[string]any `json:"identity"`
33+
IdentityVersion int64 `json:"identity_version"`
34+
ResourceType string `json:"resource_type"`
35+
ResourceObject map[string]any `json:"resource_object,omitempty"`
36+
Config string `json:"config,omitempty"`
37+
ImportConfig string `json:"import_config,omitempty"`
4038
}
4139

4240
// ListCompleteMessage represents "query" result message of type "list_complete"

logging_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
package tfjson
44

55
import (
6-
"encoding/json"
76
"testing"
87
"time"
98

@@ -131,9 +130,9 @@ func TestLogging_query(t *testing.T) {
131130
Address: "list.concept_pet.pets",
132131
ResourceType: "concept_pet",
133132
DisplayName: "This is a easy-antelope",
134-
Identity: map[string]json.RawMessage{
135-
"id": json.RawMessage(`"easy-antelope"`),
136-
"legs": json.RawMessage("6"),
133+
Identity: map[string]any{
134+
"id": "easy-antelope",
135+
"legs": float64(6),
137136
},
138137
IdentityVersion: 1,
139138
},

0 commit comments

Comments
 (0)