Fnlb was moved to its own repo: fnproject/lb (#702)

* Fnlb was moved to its own repo: fnproject/lb

* Clean up fnlb leftovers

* Newer deps
This commit is contained in:
Denis Makogon
2018-01-23 00:17:29 +02:00
committed by Reed Allman
parent 4ffa3d5005
commit d3be603e54
8310 changed files with 457462 additions and 1749312 deletions

View File

@@ -32,6 +32,31 @@ 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 TestCascadingRefExpand(t *testing.T) {
swaggerFile := "fixtures/yaml/swagger/spec.yml"
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, cascadeRefExpanded, string(b))
}
func TestFailsInvalidJSON(t *testing.T) {
_, err := Analyzed(json.RawMessage([]byte("{]")), "")
@@ -499,3 +524,194 @@ 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"
}
}
}
}
}
}
}
`
const cascadeRefExpanded = `
{
"swagger": "2.0",
"consumes":[
"application/json"
],
"produces":[
"application/json"
],
"schemes":[
"http"
],
"info":{
"description":"recursively following JSON references",
"title":"test 1",
"contact":{
"name":"Fred"
},
"version":"0.1.1"
},
"paths":{
"/getAll":{
"get":{
"operationId":"getAll",
"parameters":[
{
"description":"max number of results",
"name":"a",
"in":"body",
"schema":{
"type":"string"
}
}
],
"responses":{
"200":{
"description":"Success",
"schema":{
"type":"array",
"items":{
"type":"string"
}
}
}
}
}
}
},
"definitions":{
"a":{
"type":"string"
},
"b":{
"type":"array",
"items":{
"type":"string"
}
}
}
}
`