mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
bump(k8s.io/kube-openapi): 91cfa479c814065e420cee7ed227db0f63a5854e
This commit is contained in:
parent
debc5387fe
commit
102bc90120
18
Godeps/Godeps.json
generated
18
Godeps/Godeps.json
generated
@ -3357,39 +3357,39 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/aggregator",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/builder",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/common",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/generators",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/handler",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto/testing",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto/validation",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/utils/clock",
|
||||
|
@ -2036,23 +2036,23 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/builder",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/common",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/handler",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/equality",
|
||||
|
@ -180,7 +180,7 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
10
staging/src/k8s.io/apiserver/Godeps/Godeps.json
generated
10
staging/src/k8s.io/apiserver/Godeps/Godeps.json
generated
@ -1764,23 +1764,23 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/builder",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/common",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/handler",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/discovery",
|
||||
|
2
staging/src/k8s.io/client-go/Godeps/Godeps.json
generated
2
staging/src/k8s.io/client-go/Godeps/Godeps.json
generated
@ -588,7 +588,7 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -260,11 +260,11 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/common",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/generators",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1684,27 +1684,27 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/aggregator",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/builder",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/common",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/handler",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
2
staging/src/k8s.io/metrics/Godeps/Godeps.json
generated
2
staging/src/k8s.io/metrics/Godeps/Godeps.json
generated
@ -492,7 +492,7 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1648,23 +1648,23 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/builder",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/common",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/handler",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1076,7 +1076,7 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
"Rev": "91cfa479c814065e420cee7ed227db0f63a5854e"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
40
vendor/k8s.io/kube-openapi/pkg/builder/openapi.go
generated
vendored
40
vendor/k8s.io/kube-openapi/pkg/builder/openapi.go
generated
vendored
@ -58,7 +58,7 @@ func BuildOpenAPIDefinitionsForResource(model interface{}, config *common.Config
|
||||
o := newOpenAPI(config)
|
||||
// We can discard the return value of toSchema because all we care about is the side effect of calling it.
|
||||
// All the models created for this resource get added to o.swagger.Definitions
|
||||
_, err := o.toSchema(model)
|
||||
_, err := o.toSchema(getCanonicalTypeName(model))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -69,6 +69,21 @@ func BuildOpenAPIDefinitionsForResource(model interface{}, config *common.Config
|
||||
return &swagger.Definitions, nil
|
||||
}
|
||||
|
||||
// BuildOpenAPIDefinitionsForResources returns the OpenAPI spec which includes the definitions for the
|
||||
// passed type names.
|
||||
func BuildOpenAPIDefinitionsForResources(config *common.Config, names ...string) (*spec.Swagger, error) {
|
||||
o := newOpenAPI(config)
|
||||
// We can discard the return value of toSchema because all we care about is the side effect of calling it.
|
||||
// All the models created for this resource get added to o.swagger.Definitions
|
||||
for _, name := range names {
|
||||
_, err := o.toSchema(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return o.finalizeSwagger()
|
||||
}
|
||||
|
||||
// newOpenAPI sets up the openAPI object so we can build the spec.
|
||||
func newOpenAPI(config *common.Config) openAPI {
|
||||
o := openAPI{
|
||||
@ -120,7 +135,11 @@ func (o *openAPI) finalizeSwagger() (*spec.Swagger, error) {
|
||||
return o.swagger, nil
|
||||
}
|
||||
|
||||
func getCanonicalizeTypeName(t reflect.Type) string {
|
||||
func getCanonicalTypeName(model interface{}) string {
|
||||
t := reflect.TypeOf(model)
|
||||
if t.Kind() == reflect.Ptr {
|
||||
t = t.Elem()
|
||||
}
|
||||
if t.PkgPath() == "" {
|
||||
return t.Name()
|
||||
}
|
||||
@ -165,12 +184,7 @@ func (o *openAPI) buildDefinitionRecursively(name string) error {
|
||||
// buildDefinitionForType build a definition for a given type and return a referable name to its definition.
|
||||
// This is the main function that keep track of definitions used in this spec and is depend on code generated
|
||||
// by k8s.io/kubernetes/cmd/libs/go2idl/openapi-gen.
|
||||
func (o *openAPI) buildDefinitionForType(sample interface{}) (string, error) {
|
||||
t := reflect.TypeOf(sample)
|
||||
if t.Kind() == reflect.Ptr {
|
||||
t = t.Elem()
|
||||
}
|
||||
name := getCanonicalizeTypeName(t)
|
||||
func (o *openAPI) buildDefinitionForType(name string) (string, error) {
|
||||
if err := o.buildDefinitionRecursively(name); err != nil {
|
||||
return "", err
|
||||
}
|
||||
@ -321,7 +335,7 @@ func (o *openAPI) buildOperations(route restful.Route, inPathCommonParamsMap map
|
||||
}
|
||||
|
||||
func (o *openAPI) buildResponse(model interface{}, description string) (spec.Response, error) {
|
||||
schema, err := o.toSchema(model)
|
||||
schema, err := o.toSchema(getCanonicalTypeName(model))
|
||||
if err != nil {
|
||||
return spec.Response{}, err
|
||||
}
|
||||
@ -366,8 +380,8 @@ func (o *openAPI) findCommonParameters(routes []restful.Route) (map[interface{}]
|
||||
return commonParamsMap, nil
|
||||
}
|
||||
|
||||
func (o *openAPI) toSchema(model interface{}) (_ *spec.Schema, err error) {
|
||||
if openAPIType, openAPIFormat := common.GetOpenAPITypeFormat(getCanonicalizeTypeName(reflect.TypeOf(model))); openAPIType != "" {
|
||||
func (o *openAPI) toSchema(name string) (_ *spec.Schema, err error) {
|
||||
if openAPIType, openAPIFormat := common.GetOpenAPITypeFormat(name); openAPIType != "" {
|
||||
return &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{openAPIType},
|
||||
@ -375,7 +389,7 @@ func (o *openAPI) toSchema(model interface{}) (_ *spec.Schema, err error) {
|
||||
},
|
||||
}, nil
|
||||
} else {
|
||||
ref, err := o.buildDefinitionForType(model)
|
||||
ref, err := o.buildDefinitionForType(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -399,7 +413,7 @@ func (o *openAPI) buildParameter(restParam restful.ParameterData, bodySample int
|
||||
case restful.BodyParameterKind:
|
||||
if bodySample != nil {
|
||||
ret.In = "body"
|
||||
ret.Schema, err = o.toSchema(bodySample)
|
||||
ret.Schema, err = o.toSchema(getCanonicalTypeName(bodySample))
|
||||
return ret, err
|
||||
} else {
|
||||
// There is not enough information in the body parameter to build the definition.
|
||||
|
5
vendor/k8s.io/kube-openapi/pkg/generators/openapi.go
generated
vendored
5
vendor/k8s.io/kube-openapi/pkg/generators/openapi.go
generated
vendored
@ -383,8 +383,9 @@ func (g openAPITypeWriter) generate(t *types.Type) error {
|
||||
if hasOpenAPIDefinitionMethods(t) {
|
||||
g.Do("return $.OpenAPIDefinition|raw${\n"+
|
||||
"Schema: spec.Schema{\n"+
|
||||
"SchemaProps: spec.SchemaProps{\n"+
|
||||
"Type:$.type|raw${}.OpenAPISchemaType(),\n"+
|
||||
"SchemaProps: spec.SchemaProps{\n", args)
|
||||
g.generateDescription(t.CommentLines)
|
||||
g.Do("Type:$.type|raw${}.OpenAPISchemaType(),\n"+
|
||||
"Format:$.type|raw${}.OpenAPISchemaFormat(),\n"+
|
||||
"},\n"+
|
||||
"},\n"+
|
||||
|
Loading…
Reference in New Issue
Block a user