@@ -3,13 +3,11 @@ package httpapi_test
3
3
import (
4
4
"context"
5
5
"encoding/json"
6
- "fmt"
7
6
"io"
8
7
"log/slog"
9
8
"net/http"
10
9
"net/http/httptest"
11
10
"os"
12
- "sort"
13
11
"testing"
14
12
15
13
"github.com/coder/agentapi/lib/httpapi"
@@ -19,28 +17,6 @@ import (
19
17
"github.com/stretchr/testify/require"
20
18
)
21
19
22
- func normalizeSchema (t * testing.T , schema any ) any {
23
- t .Helper ()
24
- switch val := (schema ).(type ) {
25
- case * any :
26
- normalizeSchema (t , * val )
27
- case []any :
28
- for i := range val {
29
- normalizeSchema (t , & val [i ])
30
- }
31
- sort .SliceStable (val , func (i , j int ) bool {
32
- return fmt .Sprintf ("%v" , val [i ]) < fmt .Sprintf ("%v" , val [j ])
33
- })
34
- case map [string ]any :
35
- for k := range val {
36
- valUnderKey := val [k ]
37
- normalizeSchema (t , & valUnderKey )
38
- val [k ] = valUnderKey
39
- }
40
- }
41
- return schema
42
- }
43
-
44
20
// Ensure the OpenAPI schema on disk is up to date.
45
21
// To update the schema, run `go run main.go server --print-openapi dummy > openapi.json`.
46
22
func TestOpenAPISchema (t * testing.T ) {
@@ -79,9 +55,6 @@ func TestOpenAPISchema(t *testing.T) {
79
55
t .Fatalf ("failed to unmarshal disk schema: %s" , err )
80
56
}
81
57
82
- normalizeSchema (t , & currentSchema )
83
- normalizeSchema (t , & diskSchema )
84
-
85
58
require .Equal (t , currentSchema , diskSchema )
86
59
}
87
60
0 commit comments