Replace openapi Fake with kube-openapi version

There are two version of this fake class, let's just use that one
version.
pull/8/head
Antoine Pelisse 2018-05-31 14:00:34 -07:00
parent 178a8f87f3
commit 000510d9b7
23 changed files with 468 additions and 190 deletions

155
Godeps/Godeps.json generated
View File

@ -499,47 +499,47 @@
},
{
"ImportPath": "github.com/containerd/containerd/api/services/containers/v1",
"Comment": "v1.0.0-beta.2-159-g27d450a",
"Comment": "v1.0.0-beta.2-159-g27d450a0",
"Rev": "27d450a01bb533d7ebc5701eb52792565396b084"
},
{
"ImportPath": "github.com/containerd/containerd/api/services/tasks/v1",
"Comment": "v1.0.0-beta.2-159-g27d450a",
"Comment": "v1.0.0-beta.2-159-g27d450a0",
"Rev": "27d450a01bb533d7ebc5701eb52792565396b084"
},
{
"ImportPath": "github.com/containerd/containerd/api/services/version/v1",
"Comment": "v1.0.0-beta.2-159-g27d450a",
"Comment": "v1.0.0-beta.2-159-g27d450a0",
"Rev": "27d450a01bb533d7ebc5701eb52792565396b084"
},
{
"ImportPath": "github.com/containerd/containerd/api/types",
"Comment": "v1.0.0-beta.2-159-g27d450a",
"Comment": "v1.0.0-beta.2-159-g27d450a0",
"Rev": "27d450a01bb533d7ebc5701eb52792565396b084"
},
{
"ImportPath": "github.com/containerd/containerd/api/types/task",
"Comment": "v1.0.0-beta.2-159-g27d450a",
"Comment": "v1.0.0-beta.2-159-g27d450a0",
"Rev": "27d450a01bb533d7ebc5701eb52792565396b084"
},
{
"ImportPath": "github.com/containerd/containerd/containers",
"Comment": "v1.0.0-beta.2-159-g27d450a",
"Comment": "v1.0.0-beta.2-159-g27d450a0",
"Rev": "27d450a01bb533d7ebc5701eb52792565396b084"
},
{
"ImportPath": "github.com/containerd/containerd/dialer",
"Comment": "v1.0.0-beta.2-159-g27d450a",
"Comment": "v1.0.0-beta.2-159-g27d450a0",
"Rev": "27d450a01bb533d7ebc5701eb52792565396b084"
},
{
"ImportPath": "github.com/containerd/containerd/errdefs",
"Comment": "v1.0.0-beta.2-159-g27d450a",
"Comment": "v1.0.0-beta.2-159-g27d450a0",
"Rev": "27d450a01bb533d7ebc5701eb52792565396b084"
},
{
"ImportPath": "github.com/containerd/containerd/namespaces",
"Comment": "v1.0.0-beta.2-159-g27d450a",
"Comment": "v1.0.0-beta.2-159-g27d450a0",
"Rev": "27d450a01bb533d7ebc5701eb52792565396b084"
},
{
@ -1019,157 +1019,157 @@
},
{
"ImportPath": "github.com/docker/distribution/digestset",
"Comment": "v2.6.0-rc.1-209-gedc3ab2",
"Comment": "v2.6.0-rc.1-209-gedc3ab29",
"Rev": "edc3ab29cdff8694dd6feb85cfeb4b5f1b38ed9c"
},
{
"ImportPath": "github.com/docker/distribution/reference",
"Comment": "v2.6.0-rc.1-209-gedc3ab2",
"Comment": "v2.6.0-rc.1-209-gedc3ab29",
"Rev": "edc3ab29cdff8694dd6feb85cfeb4b5f1b38ed9c"
},
{
"ImportPath": "github.com/docker/docker/api",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/api/types",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/api/types/blkiodev",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/api/types/container",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/api/types/events",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/api/types/filters",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/api/types/image",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/api/types/mount",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/api/types/network",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/api/types/registry",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/api/types/strslice",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/api/types/swarm",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/api/types/swarm/runtime",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/api/types/time",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/api/types/versions",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/api/types/volume",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/client",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/pkg/ioutils",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/pkg/jsonlog",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/pkg/jsonmessage",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/pkg/longpath",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/pkg/mount",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/pkg/parsers",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/pkg/stdcopy",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/pkg/sysinfo",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/pkg/system",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/pkg/term",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/pkg/term/windows",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
"ImportPath": "github.com/docker/docker/pkg/tlsconfig",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
},
{
@ -1194,7 +1194,7 @@
},
{
"ImportPath": "github.com/docker/libnetwork/ipvs",
"Comment": "v0.8.0-dev.2-910-gba46b92",
"Comment": "v0.8.0-dev.2-910-gba46b928",
"Rev": "ba46b928444931e6865d8618dc03622cac79aa6f"
},
{
@ -1240,6 +1240,7 @@
},
{
"ImportPath": "github.com/evanphx/json-patch",
"Comment": "v3.0.0-23-g94e38aa",
"Rev": "94e38aa1586e8a6c8a75770bddf5ff84c48a106b"
},
{
@ -1311,132 +1312,132 @@
},
{
"ImportPath": "github.com/gogo/protobuf/gogoproto",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/plugin/compare",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/plugin/defaultcheck",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/plugin/description",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/plugin/embedcheck",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/plugin/enumstringer",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/plugin/equal",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/plugin/face",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/plugin/gostring",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/plugin/marshalto",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/plugin/oneofcheck",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/plugin/populate",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/plugin/size",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/plugin/stringer",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/plugin/testgen",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/plugin/union",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/plugin/unmarshal",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/proto",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/protoc-gen-gogo/descriptor",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/protoc-gen-gogo/generator",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/protoc-gen-gogo/grpc",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/protoc-gen-gogo/plugin",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/sortkeys",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/types",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/vanity",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/vanity/command",
"Comment": "v0.4-3-gc0656ed",
"Comment": "v0.4-3-gc0656edd",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
@ -3334,35 +3335,39 @@
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/aggregator",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/builder",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/common",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/generators",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/handler",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto/testing",
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto/validation",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/utils/clock",

210
Godeps/LICENSES generated
View File

@ -102669,6 +102669,216 @@ Apache License
================================================================================
================================================================================
= vendor/k8s.io/kube-openapi/pkg/util/proto/testing licensed under: =
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
= vendor/k8s.io/kube-openapi/LICENSE 3b83ef96387f14655fc854ddc3c6bd57
================================================================================
================================================================================
= vendor/k8s.io/kube-openapi/pkg/util/proto/validation licensed under: =

View File

@ -35,7 +35,6 @@ go_test(
data = ["//api/openapi-spec:swagger-spec"],
deps = [
":go_default_library",
"//pkg/kubectl/cmd/util/openapi/testing:go_default_library",
"//vendor/github.com/googleapis/gnostic/OpenAPIv2:go_default_library",
"//vendor/github.com/onsi/ginkgo:go_default_library",
"//vendor/github.com/onsi/ginkgo/config:go_default_library",
@ -43,6 +42,7 @@ go_test(
"//vendor/github.com/onsi/gomega:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/kube-openapi/pkg/util/proto:go_default_library",
"//vendor/k8s.io/kube-openapi/pkg/util/proto/testing:go_default_library",
],
)

View File

@ -24,11 +24,11 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/kube-openapi/pkg/util/proto"
"k8s.io/kube-openapi/pkg/util/proto/testing"
"k8s.io/kubernetes/pkg/kubectl/cmd/util/openapi"
tst "k8s.io/kubernetes/pkg/kubectl/cmd/util/openapi/testing"
)
var fakeSchema = tst.Fake{Path: filepath.Join("..", "..", "..", "..", "..", "api", "openapi-spec", "swagger.json")}
var fakeSchema = testing.Fake{Path: filepath.Join("..", "..", "..", "..", "..", "api", "openapi-spec", "swagger.json")}
var _ = Describe("Reading apps/v1beta1/Deployment from openAPIData", func() {
var resources openapi.Resources

View File

@ -11,11 +11,9 @@ go_library(
importpath = "k8s.io/kubernetes/pkg/kubectl/cmd/util/openapi/testing",
deps = [
"//pkg/kubectl/cmd/util/openapi:go_default_library",
"//vendor/github.com/googleapis/gnostic/OpenAPIv2:go_default_library",
"//vendor/github.com/googleapis/gnostic/compiler:go_default_library",
"//vendor/gopkg.in/yaml.v2:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/kube-openapi/pkg/util/proto:go_default_library",
"//vendor/k8s.io/kube-openapi/pkg/util/proto/testing:go_default_library",
],
)

View File

@ -17,59 +17,17 @@ limitations under the License.
package testing
import (
"io/ioutil"
"os"
"sync"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/kube-openapi/pkg/util/proto"
"k8s.io/kube-openapi/pkg/util/proto/testing"
"k8s.io/kubernetes/pkg/kubectl/cmd/util/openapi"
yaml "gopkg.in/yaml.v2"
"github.com/googleapis/gnostic/OpenAPIv2"
"github.com/googleapis/gnostic/compiler"
)
// Fake opens and returns a openapi swagger from a file Path. It will
// parse only once and then return the same copy everytime.
type Fake struct {
Path string
once sync.Once
document *openapi_v2.Document
err error
}
// OpenAPISchema returns the openapi document and a potential error.
func (f *Fake) OpenAPISchema() (*openapi_v2.Document, error) {
f.once.Do(func() {
_, err := os.Stat(f.Path)
if err != nil {
f.err = err
return
}
spec, err := ioutil.ReadFile(f.Path)
if err != nil {
f.err = err
return
}
var info yaml.MapSlice
err = yaml.Unmarshal(spec, &info)
if err != nil {
f.err = err
return
}
f.document, f.err = openapi_v2.NewDocument(info, compiler.NewContext("$root", nil))
})
return f.document, f.err
}
// FakeResources is a wrapper to directly load the openapi schema from a
// file, and get the schema for given GVK. This is only for test since
// it's assuming that the file is there and everything will go fine.
type FakeResources struct {
fake Fake
fake testing.Fake
}
var _ openapi.Resources = &FakeResources{}
@ -77,7 +35,7 @@ var _ openapi.Resources = &FakeResources{}
// NewFakeResources creates a new FakeResources.
func NewFakeResources(path string) *FakeResources {
return &FakeResources{
fake: Fake{Path: path},
fake: testing.Fake{Path: path},
}
}

View File

@ -31,12 +31,12 @@ go_test(
deps = [
"//pkg/api/testapi:go_default_library",
"//pkg/kubectl/cmd/util/openapi:go_default_library",
"//pkg/kubectl/cmd/util/openapi/testing:go_default_library",
"//vendor/github.com/onsi/ginkgo:go_default_library",
"//vendor/github.com/onsi/ginkgo/config:go_default_library",
"//vendor/github.com/onsi/ginkgo/types:go_default_library",
"//vendor/github.com/onsi/gomega:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/errors:go_default_library",
"//vendor/k8s.io/kube-openapi/pkg/util/proto/testing:go_default_library",
"//vendor/k8s.io/kube-openapi/pkg/util/proto/validation:go_default_library",
],
)

View File

@ -25,12 +25,12 @@ import (
utilerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/kube-openapi/pkg/util/proto/validation"
// This dependency is needed to register API types.
"k8s.io/kube-openapi/pkg/util/proto/testing"
_ "k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/kubectl/cmd/util/openapi"
tst "k8s.io/kubernetes/pkg/kubectl/cmd/util/openapi/testing"
)
var fakeSchema = tst.Fake{Path: filepath.Join("..", "..", "..", "..", "..", "..", "api", "openapi-spec", "swagger.json")}
var fakeSchema = testing.Fake{Path: filepath.Join("..", "..", "..", "..", "..", "..", "api", "openapi-spec", "swagger.json")}
var _ = Describe("resource validation using OpenAPI Schema", func() {
var validator *SchemaValidation

View File

@ -2032,23 +2032,23 @@
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/builder",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/common",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/handler",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/equality",

View File

@ -180,7 +180,7 @@
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
}
]
}

View File

@ -1760,23 +1760,23 @@
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/builder",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/common",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/handler",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/client-go/discovery",

View File

@ -588,7 +588,7 @@
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
}
]
}

View File

@ -260,11 +260,11 @@
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/common",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/generators",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
}
]
}

View File

@ -1680,27 +1680,27 @@
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/aggregator",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/builder",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/common",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/handler",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
}
]
}

View File

@ -488,7 +488,7 @@
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
}
]
}

View File

@ -1644,23 +1644,23 @@
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/builder",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/common",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/handler",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
}
]
}

View File

@ -1072,7 +1072,7 @@
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
}
]
}

View File

@ -58,7 +58,6 @@ type OpenAPIService struct {
// rwMutex protects All members of this service.
rwMutex sync.RWMutex
orgSpec *spec.Swagger
lastModified time.Time
specBytes []byte
@ -161,7 +160,6 @@ func (o *OpenAPIService) getSwaggerPbGzBytes() ([]byte, string, time.Time) {
}
func (o *OpenAPIService) UpdateSpec(openapiSpec *spec.Swagger) (err error) {
orgSpec := openapiSpec
specBytes, err := json.MarshalIndent(openapiSpec, " ", " ")
if err != nil {
return err
@ -181,7 +179,6 @@ func (o *OpenAPIService) UpdateSpec(openapiSpec *spec.Swagger) (err error) {
o.rwMutex.Lock()
defer o.rwMutex.Unlock()
o.orgSpec = orgSpec
o.specBytes = specBytes
o.specPb = specPb
o.specPbGz = specPbGz

View File

@ -26,6 +26,7 @@ filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//vendor/k8s.io/kube-openapi/pkg/util/proto/testing:all-srcs",
"//vendor/k8s.io/kube-openapi/pkg/util/proto/validation:all-srcs",
],
tags = ["automanaged"],

View File

@ -21,8 +21,8 @@ import (
"sort"
"strings"
openapi_v2 "github.com/googleapis/gnostic/OpenAPIv2"
yaml "gopkg.in/yaml.v2"
"github.com/googleapis/gnostic/OpenAPIv2"
"gopkg.in/yaml.v2"
)
func newSchemaError(path *Path, format string, a ...interface{}) error {
@ -126,13 +126,18 @@ func (d *Definitions) parseMap(s *openapi_v2.Schema, path *Path) (Schema, error)
if len(s.GetType().GetValue()) != 0 && s.GetType().GetValue()[0] != object {
return nil, newSchemaError(path, "invalid object type")
}
var sub Schema
if s.GetAdditionalProperties().GetSchema() == nil {
return nil, newSchemaError(path, "invalid object doesn't have additional properties")
sub = &Arbitrary{
BaseSchema: d.parseBaseSchema(s, path),
}
sub, err := d.ParseSchema(s.GetAdditionalProperties().GetSchema(), path)
} else {
var err error
sub, err = d.ParseSchema(s.GetAdditionalProperties().GetSchema(), path)
if err != nil {
return nil, err
}
}
return &Map{
BaseSchema: d.parseBaseSchema(s, path),
SubType: sub,
@ -148,12 +153,10 @@ func (d *Definitions) parsePrimitive(s *openapi_v2.Schema, path *Path) (Schema,
t = s.GetType().GetValue()[0]
}
switch t {
case String:
case Number:
case Integer:
case Boolean:
case "": // Some models are completely empty, and can be safely ignored.
// Do nothing
case String: // do nothing
case Number: // do nothing
case Integer: // do nothing
case Boolean: // do nothing
default:
return nil, newSchemaError(path, "Unknown primitive type: %q", t)
}
@ -219,27 +222,38 @@ func (d *Definitions) parseArbitrary(s *openapi_v2.Schema, path *Path) (Schema,
// ParseSchema creates a walkable Schema from an openapi schema. While
// this function is public, it doesn't leak through the interface.
func (d *Definitions) ParseSchema(s *openapi_v2.Schema, path *Path) (Schema, error) {
objectTypes := s.GetType().GetValue()
if len(objectTypes) == 1 {
t := objectTypes[0]
switch t {
case object:
return d.parseMap(s, path)
case array:
return d.parseArray(s, path)
}
}
if s.GetXRef() != "" {
return d.parseReference(s, path)
}
objectTypes := s.GetType().GetValue()
switch len(objectTypes) {
case 0:
// in the OpenAPI schema served by older k8s versions, object definitions created from structs did not include
// the type:object property (they only included the "properties" property), so we need to handle this case
if s.GetProperties() != nil {
return d.parseKind(s, path)
}
if len(objectTypes) == 0 || (len(objectTypes) == 1 && objectTypes[0] == "") {
} else {
// Definition has no type and no properties. Treat it as an arbitrary value
// TODO: what if it has additionalProperties or patternProperties?
return d.parseArbitrary(s, path)
}
case 1:
t := objectTypes[0]
switch t {
case object:
if s.GetProperties() != nil {
return d.parseKind(s, path)
} else {
return d.parseMap(s, path)
}
case array:
return d.parseArray(s, path)
}
return d.parsePrimitive(s, path)
default:
// the OpenAPI generator never generates (nor it ever did in the past) OpenAPI type definitions with multiple types
return nil, newSchemaError(path, "definitions with multiple types aren't supported")
}
}
// LookupModel is public through the interface of Models. It

View File

@ -59,7 +59,7 @@ type SchemaVisitor interface {
}
// SchemaVisitorArbitrary is an additional visitor interface which handles
// arbitrary types. For backwards compatability, it's a separate interface
// arbitrary types. For backwards compatibility, it's a separate interface
// which is checked for at runtime.
type SchemaVisitorArbitrary interface {
SchemaVisitor

View File

@ -0,0 +1,27 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["openapi.go"],
importpath = "k8s.io/kube-openapi/pkg/util/proto/testing",
visibility = ["//visibility:public"],
deps = [
"//vendor/github.com/googleapis/gnostic/OpenAPIv2:go_default_library",
"//vendor/github.com/googleapis/gnostic/compiler:go_default_library",
"//vendor/gopkg.in/yaml.v2:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,68 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package testing
import (
"io/ioutil"
"os"
"sync"
yaml "gopkg.in/yaml.v2"
"github.com/googleapis/gnostic/OpenAPIv2"
"github.com/googleapis/gnostic/compiler"
)
// Fake opens and returns a openapi swagger from a file Path. It will
// parse only once and then return the same copy everytime.
type Fake struct {
Path string
once sync.Once
document *openapi_v2.Document
err error
}
// OpenAPISchema returns the openapi document and a potential error.
func (f *Fake) OpenAPISchema() (*openapi_v2.Document, error) {
f.once.Do(func() {
_, err := os.Stat(f.Path)
if err != nil {
f.err = err
return
}
spec, err := ioutil.ReadFile(f.Path)
if err != nil {
f.err = err
return
}
var info yaml.MapSlice
err = yaml.Unmarshal(spec, &info)
if err != nil {
f.err = err
return
}
f.document, f.err = openapi_v2.NewDocument(info, compiler.NewContext("$root", nil))
})
return f.document, f.err
}
type Empty struct{}
func (Empty) OpenAPISchema() (*openapi_v2.Document, error) {
return nil, nil
}