Skip to content

Commit d237575

Browse files
authored
openapi3conv: test Upgrade on many documents (#1169)
1 parent 72d9005 commit d237575

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

openapi3/v3_apis_guru_openapi_directory_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/stretchr/testify/require"
1616

1717
"github.com/getkin/kin-openapi/openapi3"
18+
"github.com/getkin/kin-openapi/openapi3conv"
1819
)
1920

2021
var goldens = filepath.Join("testdata", "apis_guru_openapi_directory")
@@ -45,6 +46,7 @@ func shortNameFromPath(path string) string {
4546
shortName := filepath.Base(path)
4647
shortName = strings.TrimSuffix(shortName, "__load")
4748
shortName = strings.TrimSuffix(shortName, "__validate")
49+
shortName = strings.TrimSuffix(shortName, "__validatebis")
4850
return shortName
4951
}
5052

@@ -160,6 +162,12 @@ func TestV3ApisGuruOpenapiDirectory(t *testing.T) {
160162
var opts []openapi3.ValidationOption
161163
err = doc.Validate(loader.Context, opts...)
162164
golden(t, err, shortName, "validate")
165+
166+
if err == nil {
167+
openapi3conv.Upgrade(doc, openapi3conv.WithWriter(t.Output()))
168+
err = doc.Validate(loader.Context, opts...)
169+
golden(t, err, shortName, "validatebis")
170+
}
163171
}
164172
})
165173
}

0 commit comments

Comments
 (0)