Commit b2276b5d authored by nikhiljindal's avatar nikhiljindal

Updating pkg/api/validation/ to consider swagger.items as object and not array

parent e11f62cf
...@@ -126,7 +126,7 @@ func (s *SwaggerSchema) validateField(value interface{}, apiVersion, fieldName, ...@@ -126,7 +126,7 @@ func (s *SwaggerSchema) validateField(value interface{}, apiVersion, fieldName,
if !ok { if !ok {
return NewInvalidTypeError(reflect.Array, reflect.TypeOf(value).Kind(), fieldName) return NewInvalidTypeError(reflect.Array, reflect.TypeOf(value).Kind(), fieldName)
} }
arrType := *fieldDetails.Items[0].Ref arrType := *fieldDetails.Items.Ref
for ix := range arr { for ix := range arr {
err := s.validateField(arr[ix], apiVersion, fmt.Sprintf("%s[%d]", fieldName, ix), arrType, nil) err := s.validateField(arr[ix], apiVersion, fmt.Sprintf("%s[%d]", fieldName, ix), arrType, nil)
if err != nil { if err != nil {
......
...@@ -943,11 +943,9 @@ ...@@ -943,11 +943,9 @@
"properties": { "properties": {
"command": { "command": {
"type": "array", "type": "array",
"items": [ "items": {
{
"$ref": "string" "$ref": "string"
} }
]
}, },
"cpu": { "cpu": {
"type": "integer", "type": "integer",
...@@ -955,11 +953,9 @@ ...@@ -955,11 +953,9 @@
}, },
"env": { "env": {
"type": "array", "type": "array",
"items": [ "items": {
{
"$ref": "v1beta1.EnvVar" "$ref": "v1beta1.EnvVar"
} }
]
}, },
"image": { "image": {
"type": "string" "type": "string"
...@@ -982,11 +978,9 @@ ...@@ -982,11 +978,9 @@
}, },
"ports": { "ports": {
"type": "array", "type": "array",
"items": [ "items": {
{
"$ref": "v1beta1.Port" "$ref": "v1beta1.Port"
} }
]
}, },
"privileged": { "privileged": {
"type": "boolean" "type": "boolean"
...@@ -996,11 +990,9 @@ ...@@ -996,11 +990,9 @@
}, },
"volumeMounts": { "volumeMounts": {
"type": "array", "type": "array",
"items": [ "items": {
{
"$ref": "v1beta1.VolumeMount" "$ref": "v1beta1.VolumeMount"
} }
]
}, },
"workingDir": { "workingDir": {
"type": "string" "type": "string"
...@@ -1018,11 +1010,9 @@ ...@@ -1018,11 +1010,9 @@
"properties": { "properties": {
"containers": { "containers": {
"type": "array", "type": "array",
"items": [ "items": {
{
"$ref": "v1beta1.Container" "$ref": "v1beta1.Container"
} }
]
}, },
"id": { "id": {
"type": "string" "type": "string"
...@@ -1038,11 +1028,9 @@ ...@@ -1038,11 +1028,9 @@
}, },
"volumes": { "volumes": {
"type": "array", "type": "array",
"items": [ "items": {
{
"$ref": "v1beta1.Volume" "$ref": "v1beta1.Volume"
} }
]
} }
} }
}, },
...@@ -1075,11 +1063,9 @@ ...@@ -1075,11 +1063,9 @@
}, },
"endpoints": { "endpoints": {
"type": "array", "type": "array",
"items": [ "items": {
{
"$ref": "string" "$ref": "string"
} }
]
}, },
"id": { "id": {
"type": "string" "type": "string"
...@@ -1130,11 +1116,9 @@ ...@@ -1130,11 +1116,9 @@
}, },
"items": { "items": {
"type": "array", "type": "array",
"items": [ "items": {
{
"$ref": "v1beta1.Endpoints" "$ref": "v1beta1.Endpoints"
} }
]
}, },
"kind": { "kind": {
"type": "string" "type": "string"
...@@ -1260,11 +1244,9 @@ ...@@ -1260,11 +1244,9 @@
}, },
"items": { "items": {
"type": "array", "type": "array",
"items": [ "items": {
{
"$ref": "v1beta1.Event" "$ref": "v1beta1.Event"
} }
]
}, },
"kind": { "kind": {
"type": "string" "type": "string"
...@@ -1288,11 +1270,9 @@ ...@@ -1288,11 +1270,9 @@
"properties": { "properties": {
"command": { "command": {
"type": "array", "type": "array",
"items": [ "items": {
{
"$ref": "string" "$ref": "string"
} }
]
} }
} }
}, },
...@@ -1482,22 +1462,18 @@ ...@@ -1482,22 +1462,18 @@
}, },
"items": { "items": {
"type": "array", "type": "array",
"items": [ "items": {
{
"$ref": "v1beta1.Minion" "$ref": "v1beta1.Minion"
} }
]
}, },
"kind": { "kind": {
"type": "string" "type": "string"
}, },
"minions": { "minions": {
"type": "array", "type": "array",
"items": [ "items": {
{
"$ref": "v1beta1.Minion" "$ref": "v1beta1.Minion"
} }
]
}, },
"namespace": { "namespace": {
"type": "string" "type": "string"
...@@ -1639,11 +1615,9 @@ ...@@ -1639,11 +1615,9 @@
}, },
"items": { "items": {
"type": "array", "type": "array",
"items": [ "items": {
{
"$ref": "v1beta1.Pod" "$ref": "v1beta1.Pod"
} }
]
}, },
"kind": { "kind": {
"type": "string" "type": "string"
...@@ -1813,11 +1787,9 @@ ...@@ -1813,11 +1787,9 @@
}, },
"items": { "items": {
"type": "array", "type": "array",
"items": [ "items": {
{
"$ref": "v1beta1.ReplicationController" "$ref": "v1beta1.ReplicationController"
} }
]
}, },
"kind": { "kind": {
"type": "string" "type": "string"
...@@ -1942,11 +1914,9 @@ ...@@ -1942,11 +1914,9 @@
}, },
"publicIPs": { "publicIPs": {
"type": "array", "type": "array",
"items": [ "items": {
{
"$ref": "string" "$ref": "string"
} }
]
}, },
"resourceVersion": { "resourceVersion": {
"type": "uint64" "type": "uint64"
...@@ -1999,11 +1969,9 @@ ...@@ -1999,11 +1969,9 @@
}, },
"items": { "items": {
"type": "array", "type": "array",
"items": [ "items": {
{
"$ref": "v1beta1.Service" "$ref": "v1beta1.Service"
} }
]
}, },
"kind": { "kind": {
"type": "string" "type": "string"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment