@opensoha/contracts 0.1.22 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compat/consumer-revisions.json +2 -2
- package/compat/json-schema-ecosystem-0.1.0.json +1 -1
- package/compat/openapi-loose-boundaries-0.1.0.json +1 -1
- package/gen/go/sohaapi/client.go +1 -1
- package/gen/go/sohaapi/types.go +484 -35
- package/gen/go/sohaapi/types_test.go +30 -30
- package/gen/ts/sohaapi/index.ts +1040 -1
- package/openapi/soha-api.json +1998 -655
- package/openapi/soha-api.yaml +690 -1
- package/openapi/spec_generated.go +3 -3
- package/package.json +1 -1
|
@@ -5,36 +5,6 @@ import (
|
|
|
5
5
|
"testing"
|
|
6
6
|
)
|
|
7
7
|
|
|
8
|
-
func TestNetworkProxyInputsRemainInGoSDK(t *testing.T) {
|
|
9
|
-
for _, input := range []struct {
|
|
10
|
-
raw string
|
|
11
|
-
value any
|
|
12
|
-
}{
|
|
13
|
-
{`{"id":"proxy-a","name":"Proxy A","engine":"mihomo","host":"host-a"}`, &NetworkProxyInstanceInput{}},
|
|
14
|
-
{`{"expectedRevision":3,"enabled":false,"content":"mode: rule"}`, &NetworkProxyConfigurationInput{}},
|
|
15
|
-
} {
|
|
16
|
-
if err := json.Unmarshal([]byte(input.raw), input.value); err != nil {
|
|
17
|
-
t.Fatal(err)
|
|
18
|
-
}
|
|
19
|
-
encoded, err := json.Marshal(input.value)
|
|
20
|
-
if err != nil {
|
|
21
|
-
t.Fatal(err)
|
|
22
|
-
}
|
|
23
|
-
var before, after map[string]any
|
|
24
|
-
if err := json.Unmarshal([]byte(input.raw), &before); err != nil {
|
|
25
|
-
t.Fatal(err)
|
|
26
|
-
}
|
|
27
|
-
if err := json.Unmarshal(encoded, &after); err != nil {
|
|
28
|
-
t.Fatal(err)
|
|
29
|
-
}
|
|
30
|
-
for name, value := range before {
|
|
31
|
-
if after[name] != value {
|
|
32
|
-
t.Fatalf("%s changed during round trip: %s", name, encoded)
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
8
|
func TestToolInvocationResultPreservesAbsentVersion(t *testing.T) {
|
|
39
9
|
for _, input := range []string{
|
|
40
10
|
`{"toolName":"legacy","riskLevel":"read","requiresApproval":false,"result":"success"}`,
|
|
@@ -207,3 +177,33 @@ func TestApprovalScopeKeepsMapCompatibility(t *testing.T) {
|
|
|
207
177
|
t.Fatalf("resolved scope lost: %s", encoded)
|
|
208
178
|
}
|
|
209
179
|
}
|
|
180
|
+
|
|
181
|
+
func TestNetworkProxyInputsRemainInGoSDK(t *testing.T) {
|
|
182
|
+
for _, input := range []struct {
|
|
183
|
+
raw string
|
|
184
|
+
value any
|
|
185
|
+
}{
|
|
186
|
+
{`{"id":"proxy-a","name":"Proxy A","engine":"mihomo","host":"host-a"}`, &NetworkProxyInstanceInput{}},
|
|
187
|
+
{`{"expectedRevision":3,"enabled":false,"content":"mode: rule"}`, &NetworkProxyConfigurationInput{}},
|
|
188
|
+
} {
|
|
189
|
+
if err := json.Unmarshal([]byte(input.raw), input.value); err != nil {
|
|
190
|
+
t.Fatal(err)
|
|
191
|
+
}
|
|
192
|
+
encoded, err := json.Marshal(input.value)
|
|
193
|
+
if err != nil {
|
|
194
|
+
t.Fatal(err)
|
|
195
|
+
}
|
|
196
|
+
var before, after map[string]any
|
|
197
|
+
if err := json.Unmarshal([]byte(input.raw), &before); err != nil {
|
|
198
|
+
t.Fatal(err)
|
|
199
|
+
}
|
|
200
|
+
if err := json.Unmarshal(encoded, &after); err != nil {
|
|
201
|
+
t.Fatal(err)
|
|
202
|
+
}
|
|
203
|
+
for name, value := range before {
|
|
204
|
+
if after[name] != value {
|
|
205
|
+
t.Fatalf("%s changed during round trip: %s", name, encoded)
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|