@@ -208,17 +208,16 @@ var testRoutes = []*Route{
208208 Tag : example2TagName ,
209209 },
210210 {
211- Name : "op8" ,
212- Path : "example8" ,
213- Method : http .MethodGet ,
214- PathParams : nil ,
215- QueryParams : nil ,
216- Description : ExampleDesc ,
217- JSONInputValue : func () interface {} { return nil },
211+ Name : "op8" ,
212+ Path : "example8" ,
213+ Method : http .MethodGet ,
214+ PathParams : nil ,
215+ QueryParams : nil ,
216+ Description : ExampleDesc ,
217+ JSONInputValue : func () interface {} { return nil },
218218 JSONOutputValue : func () interface {} { return & TestExtensions {} },
219219 JSONOutputCodes : []int {http .StatusOK },
220220 },
221-
222221}
223222
224223type TestInOutType struct {
@@ -608,10 +607,10 @@ func TestExcludeFromOpenAPI(t *testing.T) {
608607func TestExtensionsBadEncodingFail (t * testing.T ) {
609608 routes := []* Route {
610609 {
611- Name : "badEncoding" ,
612- Path : "extensions" ,
613- Method : http .MethodGet ,
614- JSONInputValue : func () interface {} { return nil },
610+ Name : "badEncoding" ,
611+ Path : "extensions" ,
612+ Method : http .MethodGet ,
613+ JSONInputValue : func () interface {} { return nil },
615614 JSONOutputValue : func () interface {} { return & TestExtensionsBadEncoding {} },
616615 JSONOutputCodes : []int {http .StatusOK },
617616 },
@@ -629,10 +628,10 @@ func TestExtensionsBadEncodingFail(t *testing.T) {
629628func TestExtensionsBadKeyFail (t * testing.T ) {
630629 routes := []* Route {
631630 {
632- Name : "bad3" ,
633- Path : "extensions" ,
634- Method : http .MethodGet ,
635- JSONInputValue : func () interface {} { return nil },
631+ Name : "bad3" ,
632+ Path : "extensions" ,
633+ Method : http .MethodGet ,
634+ JSONInputValue : func () interface {} { return nil },
636635 JSONOutputValue : func () interface {} { return & TestExtensionsBadKey {} },
637636 JSONOutputCodes : []int {http .StatusOK },
638637 },
@@ -646,3 +645,15 @@ func TestExtensionsBadKeyFail(t *testing.T) {
646645 }).Generate (context .Background (), routes )
647646 })
648647}
648+
649+ func TestOpenAPIVersion (t * testing.T ) {
650+ doc := NewSwaggerGen (& SwaggerGenOptions {
651+ Title : "UnitTest" ,
652+ Version : "1.0" ,
653+ OpenAPIVersion : "3.1.1" ,
654+ BaseURL : "http://localhost:12345/api/v1" ,
655+ }).Generate (context .Background (), testRoutes )
656+ err := doc .Validate (context .Background ())
657+ assert .NoError (t , err )
658+ assert .Equal (t , "3.1.1" , doc .OpenAPI )
659+ }
0 commit comments