mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #37059 from mbohlool/dev2
Automatic merge from submit-queue OpenAPI Bugfix: []byte should be treated as integer array data field of v1.Secret is a map of string to byte array. Generated spec should generate a map of string to (type="string", format="byte" that means map of base64 string) however current code converts it to an array of integer that is wrong. fixes #37126
This commit is contained in:
commit
75affa4a43
@ -34956,11 +34956,8 @@
|
||||
"description": "Data contains the secret data. Each key must be a valid DNS_SUBDOMAIN or leading dot followed by valid DNS_SUBDOMAIN. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "byte"
|
||||
}
|
||||
"type": "string",
|
||||
"format": "byte"
|
||||
}
|
||||
},
|
||||
"metadata": {
|
||||
|
@ -446,10 +446,15 @@ func (g openAPITypeWriter) generateMapProperty(t *types.Type) error {
|
||||
}
|
||||
g.Do("Type: []string{\"object\"},\n", nil)
|
||||
g.Do("AdditionalProperties: &spec.SchemaOrBool{\nSchema: &spec.Schema{\nSchemaProps: spec.SchemaProps{\n", nil)
|
||||
typeString, format := common.GetOpenAPITypeFormat(elemType.String())
|
||||
if typeString != "" {
|
||||
g.generateSimpleProperty(typeString, format)
|
||||
g.Do("},\n},\n},\n", nil)
|
||||
return nil
|
||||
}
|
||||
switch elemType.Kind {
|
||||
case types.Builtin:
|
||||
typeString, format := common.GetOpenAPITypeFormat(elemType.String())
|
||||
g.generateSimpleProperty(typeString, format)
|
||||
return fmt.Errorf("please add type %v to getOpenAPITypeFormat function.", elemType)
|
||||
case types.Struct:
|
||||
g.generateReferenceProperty(t.Elem)
|
||||
case types.Slice, types.Array:
|
||||
@ -465,10 +470,15 @@ func (g openAPITypeWriter) generateSliceProperty(t *types.Type) error {
|
||||
elemType := resolveAliasAndPtrType(t.Elem)
|
||||
g.Do("Type: []string{\"array\"},\n", nil)
|
||||
g.Do("Items: &spec.SchemaOrArray{\nSchema: &spec.Schema{\nSchemaProps: spec.SchemaProps{\n", nil)
|
||||
typeString, format := common.GetOpenAPITypeFormat(elemType.String())
|
||||
if typeString != "" {
|
||||
g.generateSimpleProperty(typeString, format)
|
||||
g.Do("},\n},\n},\n", nil)
|
||||
return nil
|
||||
}
|
||||
switch elemType.Kind {
|
||||
case types.Builtin:
|
||||
typeString, format := common.GetOpenAPITypeFormat(elemType.String())
|
||||
g.generateSimpleProperty(typeString, format)
|
||||
return fmt.Errorf("please add type %v to getOpenAPITypeFormat function.", elemType)
|
||||
case types.Struct:
|
||||
g.generateReferenceProperty(t.Elem)
|
||||
default:
|
||||
|
@ -9273,11 +9273,8 @@
|
||||
"description": "Data contains the secret data. Each key must be a valid DNS_SUBDOMAIN or leading dot followed by valid DNS_SUBDOMAIN. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "byte"
|
||||
}
|
||||
"type": "string",
|
||||
"format": "byte"
|
||||
}
|
||||
},
|
||||
"metadata": {
|
||||
|
@ -12326,15 +12326,8 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
|
||||
AdditionalProperties: &spec.SchemaOrBool{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"integer"},
|
||||
Format: "byte",
|
||||
},
|
||||
},
|
||||
},
|
||||
Type: []string{"string"},
|
||||
Format: "byte",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user