@@ -402,42 +402,44 @@ func TestGetServerResources(t *testing.T) {
402
402
}
403
403
}
404
404
405
- var returnedOpenAPI = openapi_v2.Document {
406
- Definitions : & openapi_v2.Definitions {
407
- AdditionalProperties : []* openapi_v2.NamedSchema {
408
- {
409
- Name : "fake.type.1" ,
410
- Value : & openapi_v2.Schema {
411
- Properties : & openapi_v2.Properties {
412
- AdditionalProperties : []* openapi_v2.NamedSchema {
413
- {
414
- Name : "count" ,
415
- Value : & openapi_v2.Schema {
416
- Type : & openapi_v2.TypeItem {
417
- Value : []string {"integer" },
405
+ func returnedOpenAPI () * openapi_v2.Document {
406
+ return & openapi_v2.Document {
407
+ Definitions : & openapi_v2.Definitions {
408
+ AdditionalProperties : []* openapi_v2.NamedSchema {
409
+ {
410
+ Name : "fake.type.1" ,
411
+ Value : & openapi_v2.Schema {
412
+ Properties : & openapi_v2.Properties {
413
+ AdditionalProperties : []* openapi_v2.NamedSchema {
414
+ {
415
+ Name : "count" ,
416
+ Value : & openapi_v2.Schema {
417
+ Type : & openapi_v2.TypeItem {
418
+ Value : []string {"integer" },
419
+ },
418
420
},
419
421
},
420
422
},
421
423
},
422
424
},
423
425
},
424
- },
425
- {
426
- Name : "fake.type.2" ,
427
- Value : & openapi_v2.Schema {
428
- Properties : & openapi_v2.Properties {
429
- AdditionalProperties : [] * openapi_v2. NamedSchema {
430
- {
431
- Name : "count" ,
432
- Value : & openapi_v2.Schema {
433
- Type : & openapi_v2. TypeItem {
434
- Value : [] string { "array" },
435
- },
436
- Items : & openapi_v2.ItemsItem {
437
- Schema : [] * openapi_v2. Schema {
438
- {
439
- Type : & openapi_v2. TypeItem {
440
- Value : [] string { "string" },
426
+ {
427
+ Name : "fake.type.2" ,
428
+ Value : & openapi_v2. Schema {
429
+ Properties : & openapi_v2.Properties {
430
+ AdditionalProperties : [] * openapi_v2.NamedSchema {
431
+ {
432
+ Name : "count" ,
433
+ Value : & openapi_v2. Schema {
434
+ Type : & openapi_v2.TypeItem {
435
+ Value : [] string { "array" },
436
+ },
437
+ Items : & openapi_v2. ItemsItem {
438
+ Schema : [] * openapi_v2.Schema {
439
+ {
440
+ Type : & openapi_v2. TypeItem {
441
+ Value : [] string { "string" },
442
+ },
441
443
},
442
444
},
443
445
},
@@ -449,7 +451,7 @@ var returnedOpenAPI = openapi_v2.Document{
449
451
},
450
452
},
451
453
},
452
- },
454
+ }
453
455
}
454
456
455
457
func openapiSchemaDeprecatedFakeServer (status int ) (* httptest.Server , error ) {
@@ -469,7 +471,7 @@ func openapiSchemaDeprecatedFakeServer(status int) (*httptest.Server, error) {
469
471
470
472
mime .AddExtensionType (".pb-v1" , "application/com.github.googleapis.gnostic.OpenAPIv2@68f4ded+protobuf" )
471
473
472
- output , err := proto .Marshal (& returnedOpenAPI )
474
+ output , err := proto .Marshal (returnedOpenAPI () )
473
475
if err != nil {
474
476
sErr = err
475
477
return
@@ -496,7 +498,7 @@ func openapiSchemaFakeServer() (*httptest.Server, error) {
496
498
497
499
mime .AddExtensionType (".pb-v1" , "application/com.github.googleapis.gnostic.OpenAPIv2@68f4ded+protobuf" )
498
500
499
- output , err := proto .Marshal (& returnedOpenAPI )
501
+ output , err := proto .Marshal (returnedOpenAPI () )
500
502
if err != nil {
501
503
sErr = err
502
504
return
@@ -519,7 +521,7 @@ func TestGetOpenAPISchema(t *testing.T) {
519
521
if err != nil {
520
522
t .Fatalf ("unexpected error getting openapi: %v" , err )
521
523
}
522
- if e , a := returnedOpenAPI , * got ; ! reflect .DeepEqual (e , a ) {
524
+ if e , a := returnedOpenAPI (), got ; ! reflect .DeepEqual (e , a ) {
523
525
t .Errorf ("expected %v, got %v" , e , a )
524
526
}
525
527
}
@@ -536,7 +538,7 @@ func TestGetOpenAPISchemaForbiddenFallback(t *testing.T) {
536
538
if err != nil {
537
539
t .Fatalf ("unexpected error getting openapi: %v" , err )
538
540
}
539
- if e , a := returnedOpenAPI , * got ; ! reflect .DeepEqual (e , a ) {
541
+ if e , a := returnedOpenAPI (), got ; ! reflect .DeepEqual (e , a ) {
540
542
t .Errorf ("expected %v, got %v" , e , a )
541
543
}
542
544
}
@@ -553,7 +555,7 @@ func TestGetOpenAPISchemaNotFoundFallback(t *testing.T) {
553
555
if err != nil {
554
556
t .Fatalf ("unexpected error getting openapi: %v" , err )
555
557
}
556
- if e , a := returnedOpenAPI , * got ; ! reflect .DeepEqual (e , a ) {
558
+ if e , a := returnedOpenAPI (), got ; ! reflect .DeepEqual (e , a ) {
557
559
t .Errorf ("expected %v, got %v" , e , a )
558
560
}
559
561
}
@@ -570,7 +572,7 @@ func TestGetOpenAPISchemaNotAcceptableFallback(t *testing.T) {
570
572
if err != nil {
571
573
t .Fatalf ("unexpected error getting openapi: %v" , err )
572
574
}
573
- if e , a := returnedOpenAPI , * got ; ! reflect .DeepEqual (e , a ) {
575
+ if e , a := returnedOpenAPI (), got ; ! reflect .DeepEqual (e , a ) {
574
576
t .Errorf ("expected %v, got %v" , e , a )
575
577
}
576
578
}
0 commit comments