mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Update dependencies
This commit is contained in:
8
vendor/github.com/go-openapi/analysis/fixtures/empty-paths.json
generated
vendored
Normal file
8
vendor/github.com/go-openapi/analysis/fixtures/empty-paths.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "empty-paths",
|
||||
"version": "79.2.1"
|
||||
},
|
||||
"paths": {}
|
||||
}
|
||||
13
vendor/github.com/go-openapi/analysis/mixin.go
generated
vendored
13
vendor/github.com/go-openapi/analysis/mixin.go
generated
vendored
@@ -32,6 +32,19 @@ func Mixin(primary *spec.Swagger, mixins ...*spec.Swagger) []string {
|
||||
if primary.Paths == nil {
|
||||
primary.Paths = &spec.Paths{Paths: make(map[string]spec.PathItem)}
|
||||
}
|
||||
if primary.Paths.Paths == nil {
|
||||
primary.Paths.Paths = make(map[string]spec.PathItem)
|
||||
}
|
||||
if primary.Definitions == nil {
|
||||
primary.Definitions = make(spec.Definitions)
|
||||
}
|
||||
if primary.Parameters == nil {
|
||||
primary.Parameters = make(map[string]spec.Parameter)
|
||||
}
|
||||
if primary.Responses == nil {
|
||||
primary.Responses = make(map[string]spec.Response)
|
||||
}
|
||||
|
||||
for i, m := range mixins {
|
||||
for k, v := range m.Definitions {
|
||||
// assume name collisions represent IDENTICAL type. careful.
|
||||
|
||||
20
vendor/github.com/go-openapi/analysis/mixin_test.go
generated
vendored
20
vendor/github.com/go-openapi/analysis/mixin_test.go
generated
vendored
@@ -3,10 +3,11 @@ package analysis
|
||||
import "testing"
|
||||
|
||||
const (
|
||||
widgetFile = "fixtures/widget-crud.yml"
|
||||
fooFile = "fixtures/foo-crud.yml"
|
||||
barFile = "fixtures/bar-crud.yml"
|
||||
noPathsFile = "fixtures/no-paths.yml"
|
||||
widgetFile = "fixtures/widget-crud.yml"
|
||||
fooFile = "fixtures/foo-crud.yml"
|
||||
barFile = "fixtures/bar-crud.yml"
|
||||
noPathsFile = "fixtures/no-paths.yml"
|
||||
emptyPathsFile = "fixtures/empty-paths.json"
|
||||
)
|
||||
|
||||
func TestMixin(t *testing.T) {
|
||||
@@ -49,4 +50,15 @@ func TestMixin(t *testing.T) {
|
||||
t.Errorf("TestMixin: Expected 2 top level responses in merged, got %v\n", len(primary.Responses))
|
||||
}
|
||||
|
||||
// test that adding paths to a primary with no paths works (was NPE)
|
||||
emptyPaths, err := loadSpec(emptyPathsFile)
|
||||
if err != nil {
|
||||
t.Fatalf("Could not load '%v': %v\n", emptyPathsFile, err)
|
||||
}
|
||||
|
||||
collisions = Mixin(emptyPaths, primary)
|
||||
if len(collisions) != 0 {
|
||||
t.Errorf("TestMixin: Expected 0 collisions, got %v\n%v", len(collisions), collisions)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user