Closed alexzielenski closed 8 months ago
I've been testing our some of our marker comments on native types. I've found an issue where having an array with +enum does not result in the items of the array validating the enum.
items
enum
/cc @jiahuif
Example:
https://github.com/kubernetes/kubernetes/blob/7ec1a89a509906dad9fd6a4635d7bfc157b47790/staging/src/k8s.io/api/core/v1/types.go#L331-L335
PersistentVolumeSpec.AccessModes above is a []PersistentVolumeAccessMode. This type is tagged with +enum.
[]PersistentVolumeAccessMode
+enum
Unfortunately the generated OpenAPI does not include (can't direct link line in large file) the enum values in the items for this field:
func schema_k8sio_api_core_v1_PersistentVolumeSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "PersistentVolumeSpec is the specification of a persistent volume.", Type: []string{"object"}, Properties: map[string]spec.Schema{ ... "accessModes": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ "x-kubernetes-list-type": "atomic", }, }, SchemaProps: spec.SchemaProps{ Description: "accessModes contains all ways the volume can be mounted. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ Default: "", Type: []string{"string"}, Format: "", }, }, }, }, }, ... }
I've been testing our some of our marker comments on native types. I've found an issue where having an array with +enum does not result in the
items
of the array validating theenum
./cc @jiahuif
Example:
https://github.com/kubernetes/kubernetes/blob/7ec1a89a509906dad9fd6a4635d7bfc157b47790/staging/src/k8s.io/api/core/v1/types.go#L331-L335
PersistentVolumeSpec.AccessModes above is a
[]PersistentVolumeAccessMode
. This type is tagged with+enum
.Unfortunately the generated OpenAPI does not include (can't direct link line in large file) the enum values in the
items
for this field: