Update dependencies

This commit is contained in:
James
2017-08-16 11:15:14 -07:00
parent b9c0374fe3
commit f46ea14760
1220 changed files with 142690 additions and 47576 deletions

View File

@@ -0,0 +1,8 @@
{
"swagger": "2.0",
"info": {
"title": "empty-paths",
"version": "79.2.1"
},
"paths": {}
}

View File

@@ -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.

View File

@@ -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)
}
}