mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
add "object" type to list schema openapi
to not include a type for v3 means it can be treated as a list
This commit is contained in:
parent
0c0f524318
commit
ac21010134
@ -499,7 +499,9 @@ func addTypeMetaProperties(s *spec.Schema, v2 bool) {
|
|||||||
func (b *builder) buildListSchema(v2 bool) *spec.Schema {
|
func (b *builder) buildListSchema(v2 bool) *spec.Schema {
|
||||||
name := definitionPrefix + util.ToRESTFriendlyName(fmt.Sprintf("%s/%s/%s", b.group, b.version, b.kind))
|
name := definitionPrefix + util.ToRESTFriendlyName(fmt.Sprintf("%s/%s/%s", b.group, b.version, b.kind))
|
||||||
doc := fmt.Sprintf("List of %s. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md", b.plural)
|
doc := fmt.Sprintf("List of %s. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md", b.plural)
|
||||||
s := new(spec.Schema).WithDescription(fmt.Sprintf("%s is a list of %s", b.listKind, b.kind)).
|
s := new(spec.Schema).
|
||||||
|
Typed("object", "").
|
||||||
|
WithDescription(fmt.Sprintf("%s is a list of %s", b.listKind, b.kind)).
|
||||||
WithRequired("items").
|
WithRequired("items").
|
||||||
SetProperty("items", *spec.ArrayProperty(spec.RefSchema(refForOpenAPIVersion(name, v2))).WithDescription(doc)).
|
SetProperty("items", *spec.ArrayProperty(spec.RefSchema(refForOpenAPIVersion(name, v2))).WithDescription(doc)).
|
||||||
SetProperty("metadata", *spec.RefSchema(refForOpenAPIVersion(listMetaSchemaRef, v2)).WithDescription(swaggerPartialObjectMetadataListDescriptions["metadata"]))
|
SetProperty("metadata", *spec.RefSchema(refForOpenAPIVersion(listMetaSchemaRef, v2)).WithDescription(swaggerPartialObjectMetadataListDescriptions["metadata"]))
|
||||||
|
Loading…
Reference in New Issue
Block a user