Skip to content

Commit 64055d3

Browse files
Merge pull request #137075 from vinayakray19/feature/enable-optionalreq-for-apidiscovery
Enable the optionalorrequired linter for the apidiscovery API group Kubernetes-commit: 0a80eebe7ab3d62bcde45e9de459d9e74d3d4c84
2 parents d7f9921 + f292305 commit 64055d3

6 files changed

Lines changed: 71 additions & 3 deletions

File tree

apidiscovery/v2/generated.proto

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apidiscovery/v2/types.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type APIGroupDiscoveryList struct {
3434
// +optional
3535
v1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
3636
// items is the list of groups for discovery. The groups are listed in priority order.
37+
// +optional
3738
Items []APIGroupDiscovery `json:"items" protobuf:"bytes,2,rep,name=items"`
3839
}
3940

@@ -56,16 +57,19 @@ type APIGroupDiscovery struct {
5657
// with the preferred version being the first entry.
5758
// +listType=map
5859
// +listMapKey=version
60+
// +optional
5961
Versions []APIVersionDiscovery `json:"versions,omitempty" protobuf:"bytes,2,rep,name=versions"`
6062
}
6163

6264
// APIVersionDiscovery holds a list of APIResourceDiscovery types that are served for a particular version within an API Group.
6365
type APIVersionDiscovery struct {
6466
// version is the name of the version within a group version.
67+
// +optional
6568
Version string `json:"version" protobuf:"bytes,1,opt,name=version"`
6669
// resources is a list of APIResourceDiscovery objects for the corresponding group version.
6770
// +listType=map
6871
// +listMapKey=resource
72+
// +optional
6973
Resources []APIResourceDiscovery `json:"resources,omitempty" protobuf:"bytes,2,rep,name=resources"`
7074
// freshness marks whether a group version's discovery document is up to date.
7175
// "Current" indicates the discovery document was recently
@@ -74,6 +78,7 @@ type APIVersionDiscovery struct {
7478
// significantly out of date. Clients that require the latest
7579
// version of the discovery information be retrieved before
7680
// performing an operation should not use the aggregated document
81+
// +optional
7782
Freshness DiscoveryFreshness `json:"freshness,omitempty" protobuf:"bytes,3,opt,name=freshness"`
7883
}
7984

@@ -83,33 +88,41 @@ type APIResourceDiscovery struct {
8388
// for this resource across all versions in the API group.
8489
// Resources with non-empty groups are located at /apis/<APIGroupDiscovery.objectMeta.name>/<APIVersionDiscovery.version>/<APIResourceDiscovery.Resource>
8590
// Resources with empty groups are located at /api/v1/<APIResourceDiscovery.Resource>
91+
// +optional
8692
Resource string `json:"resource" protobuf:"bytes,1,opt,name=resource"`
8793
// responseKind describes the group, version, and kind of the serialization schema for the object type this endpoint typically returns.
8894
// APIs may return other objects types at their discretion, such as error conditions, requests for alternate representations, or other operation specific behavior.
8995
// This value will be null or empty if an APIService reports subresources but supports no operations on the parent resource
96+
// +optional
9097
ResponseKind *v1.GroupVersionKind `json:"responseKind,omitempty" protobuf:"bytes,2,opt,name=responseKind"`
9198
// scope indicates the scope of a resource, either Cluster or Namespaced
99+
// +optional
92100
Scope ResourceScope `json:"scope" protobuf:"bytes,3,opt,name=scope"`
93101
// singularResource is the singular name of the resource. This allows clients to handle plural and singular opaquely.
94102
// For many clients the singular form of the resource will be more understandable to users reading messages and should be used when integrating the name of the resource into a sentence.
95103
// The command line tool kubectl, for example, allows use of the singular resource name in place of plurals.
96104
// The singular form of a resource should always be an optional element - when in doubt use the canonical resource name.
105+
// +optional
97106
SingularResource string `json:"singularResource" protobuf:"bytes,4,opt,name=singularResource"`
98107
// verbs is a list of supported API operation types (this includes
99108
// but is not limited to get, list, watch, create, update, patch,
100109
// delete, deletecollection, and proxy).
101110
// +listType=set
111+
// +optional
102112
Verbs []string `json:"verbs" protobuf:"bytes,5,opt,name=verbs"`
103113
// shortNames is a list of suggested short names of the resource.
104114
// +listType=set
115+
// +optional
105116
ShortNames []string `json:"shortNames,omitempty" protobuf:"bytes,6,rep,name=shortNames"`
106117
// categories is a list of the grouped resources this resource belongs to (e.g. 'all').
107118
// Clients may use this to simplify acting on multiple resource types at once.
108119
// +listType=set
120+
// +optional
109121
Categories []string `json:"categories,omitempty" protobuf:"bytes,7,rep,name=categories"`
110122
// subresources is a list of subresources provided by this resource. Subresources are located at /apis/<APIGroupDiscovery.objectMeta.name>/<APIVersionDiscovery.version>/<APIResourceDiscovery.Resource>/name-of-instance/<APIResourceDiscovery.subresources[i].subresource>
111123
// +listType=map
112124
// +listMapKey=subresource
125+
// +optional
113126
Subresources []APISubresourceDiscovery `json:"subresources,omitempty" protobuf:"bytes,8,rep,name=subresources"`
114127
}
115128

@@ -133,9 +146,11 @@ const (
133146
type APISubresourceDiscovery struct {
134147
// subresource is the name of the subresource. This is used in the URL path and is the unique identifier
135148
// for this resource across all versions.
149+
// +optional
136150
Subresource string `json:"subresource" protobuf:"bytes,1,opt,name=subresource"`
137151
// responseKind describes the group, version, and kind of the serialization schema for the object type this endpoint typically returns.
138152
// Some subresources do not return normal resources, these will have null or empty return types.
153+
// +optional
139154
ResponseKind *v1.GroupVersionKind `json:"responseKind,omitempty" protobuf:"bytes,2,opt,name=responseKind"`
140155
// acceptedTypes describes the kinds that this endpoint accepts.
141156
// Subresources may accept the standard content types or define
@@ -145,6 +160,7 @@ type APISubresourceDiscovery struct {
145160
// +listMapKey=group
146161
// +listMapKey=version
147162
// +listMapKey=kind
163+
// +optional
148164
AcceptedTypes []v1.GroupVersionKind `json:"acceptedTypes,omitempty" protobuf:"bytes,3,rep,name=acceptedTypes"`
149165
// verbs is a list of supported API operation types (this includes
150166
// but is not limited to get, list, watch, create, update, patch,
@@ -153,5 +169,6 @@ type APISubresourceDiscovery struct {
153169
// should expect the behavior of standard verbs to align with
154170
// Kubernetes interaction conventions.
155171
// +listType=set
172+
// +optional
156173
Verbs []string `json:"verbs" protobuf:"bytes,4,opt,name=verbs"`
157174
}

apidiscovery/v2beta1/generated.proto

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)