diff options
author | 2017-11-03 00:20:15 -0700 | |
---|---|---|
committer | 2017-11-03 07:20:15 +0000 | |
commit | 1fc0c16968304b169fb7eb52f162ffa4c7cdc55c (patch) | |
tree | e242db88ffc7aa291a6344d1ab1d6cd07293cba7 /vendor/github.com/go-openapi/loads | |
parent | af6086d6535e3309e3bd1e521cb4d51ef113f850 (diff) | |
download | coredns-1fc0c16968304b169fb7eb52f162ffa4c7cdc55c.tar.gz coredns-1fc0c16968304b169fb7eb52f162ffa4c7cdc55c.tar.zst coredns-1fc0c16968304b169fb7eb52f162ffa4c7cdc55c.zip |
Update vendor libraries except client-go, apimachinery and ugorji/go (#1197)
This fix updates vendor libraries except client-go, apimachinery
and ugorji/go, as github.com/ugorji/go/codec is causing compatibilities issues.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Diffstat (limited to 'vendor/github.com/go-openapi/loads')
-rw-r--r-- | vendor/github.com/go-openapi/loads/spec.go | 2 | ||||
-rw-r--r-- | vendor/github.com/go-openapi/loads/spec_test.go | 142 |
2 files changed, 143 insertions, 1 deletions
diff --git a/vendor/github.com/go-openapi/loads/spec.go b/vendor/github.com/go-openapi/loads/spec.go index 6d967389b..2db5cb558 100644 --- a/vendor/github.com/go-openapi/loads/spec.go +++ b/vendor/github.com/go-openapi/loads/spec.go @@ -186,7 +186,7 @@ func (d *Document) Expanded(options ...*spec.ExpandOptions) (*Document, error) { var expandOptions *spec.ExpandOptions if len(options) > 0 { - expandOptions = options[1] + expandOptions = options[0] } else { expandOptions = &spec.ExpandOptions{ RelativeBase: filepath.Dir(d.specFilePath), diff --git a/vendor/github.com/go-openapi/loads/spec_test.go b/vendor/github.com/go-openapi/loads/spec_test.go index 5c5e7ca4e..a3b241d95 100644 --- a/vendor/github.com/go-openapi/loads/spec_test.go +++ b/vendor/github.com/go-openapi/loads/spec_test.go @@ -32,6 +32,19 @@ func TestLoadsYAMLContent(t *testing.T) { } } +// for issue 11 +func TestRegressionExpand(t *testing.T) { + swaggerFile := "fixtures/yaml/swagger/1/2/3/4/swagger.yaml" + document, err := Spec(swaggerFile) + assert.NoError(t, err) + assert.NotNil(t, document) + d, err := document.Expanded() + assert.NoError(t, err) + assert.NotNil(t, d) + b, _ := d.Spec().MarshalJSON() + assert.JSONEq(t, expectedExpanded, string(b)) +} + func TestFailsInvalidJSON(t *testing.T) { _, err := Analyzed(json.RawMessage([]byte("{]")), "") @@ -499,3 +512,132 @@ const PetStore20 = `{ } } ` + +const expectedExpanded = ` +{ + "produces":[ + "application/json", + "plain/text" + ], + "schemes":[ + "https", + "http" + ], + "swagger":"2.0", + "info":{ + "description":"Something", + "title":"Something", + "contact":{ + "name":"Somebody", + "url":"https://url.com", + "email":"email@url.com" + }, + "version":"v1" + }, + "host":"security.sonusnet.com", + "basePath":"/api", + "paths":{ + "/whatnot":{ + "get":{ + "description":"Get something", + "responses":{ + "200":{ + "description":"The something", + "schema":{ + "description":"A collection of service events", + "type":"object", + "properties":{ + "page":{ + "description":"A description of a paged result", + "type":"object", + "properties":{ + "page":{ + "description":"the page that was requested", + "type":"integer" + }, + "page_items":{ + "description":"the number of items per page requested", + "type":"integer" + }, + "pages":{ + "description":"the total number of pages available", + "type":"integer" + }, + "total_items":{ + "description":"the total number of items available", + "type":"integer", + "format":"int64" + } + } + }, + "something":{ + "description":"Something", + "type":"object", + "properties":{ + "p1":{ + "description":"A string", + "type":"string" + }, + "p2":{ + "description":"An integer", + "type":"integer" + } + } + } + } + } + }, + "500":{ + "description":"Oops" + } + } + } + } + }, + "definitions":{ + "Something":{ + "description":"A collection of service events", + "type":"object", + "properties":{ + "page":{ + "description":"A description of a paged result", + "type":"object", + "properties":{ + "page":{ + "description":"the page that was requested", + "type":"integer" + }, + "page_items":{ + "description":"the number of items per page requested", + "type":"integer" + }, + "pages":{ + "description":"the total number of pages available", + "type":"integer" + }, + "total_items":{ + "description":"the total number of items available", + "type":"integer", + "format":"int64" + } + } + }, + "something":{ + "description":"Something", + "type":"object", + "properties":{ + "p1":{ + "description":"A string", + "type":"string" + }, + "p2":{ + "description":"An integer", + "type":"integer" + } + } + } + } + } + } +} +` |