Skip to content

Commit 21580f6

Browse files
authored
Add missing omitempty parameter to APIs (#1645)
1 parent 3fadef6 commit 21580f6

File tree

16 files changed

+30
-61
lines changed

16 files changed

+30
-61
lines changed

pkg/apis/controller/common/v1beta1/common_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ type Metric struct {
150150
// +k8s:deepcopy-gen=true
151151
type Observation struct {
152152
// Key-value pairs for metric names and values
153-
Metrics []Metric `json:"metrics"`
153+
Metrics []Metric `json:"metrics,omitempty"`
154154
}
155155

156156
// +k8s:deepcopy-gen=true
@@ -220,7 +220,7 @@ const (
220220

221221
// +k8s:deepcopy-gen=true
222222
type CollectorSpec struct {
223-
Kind CollectorKind `json:"kind"`
223+
Kind CollectorKind `json:"kind,omitempty"`
224224
// When kind is "customCollector", this field will be used
225225
CustomCollector *v1.Container `json:"customCollector,omitempty"`
226226
}

pkg/apis/controller/experiments/v1beta1/experiment_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ type ExperimentStatus struct {
125125
// OptimalTrial is the metrics and assignments of the best trial.
126126
type OptimalTrial struct {
127127
// BestTrialName is the name of the best trial.
128-
BestTrialName string `json:"bestTrialName"`
128+
BestTrialName string `json:"bestTrialName,omitempty"`
129129
// Key-value pairs for hyperparameters and assignment values.
130-
ParameterAssignments []common.ParameterAssignment `json:"parameterAssignments"`
130+
ParameterAssignments []common.ParameterAssignment `json:"parameterAssignments,omitempty"`
131131

132132
// Observation for this trial
133133
Observation common.Observation `json:"observation,omitempty"`

pkg/apis/controller/suggestions/v1beta1/suggestion_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
// SuggestionSpec is the specification of a Suggestion.
2929
type SuggestionSpec struct {
3030
// Algorithm describes HP or NAS algorithm that suggestion is used.
31-
Algorithm *common.AlgorithmSpec `json:"algorithm"`
31+
Algorithm *common.AlgorithmSpec `json:"algorithm,omitempty"`
3232

3333
// EarlyStopping describes early stopping algorithm that suggestion is used.
3434
EarlyStopping *common.EarlyStoppingSpec `json:"earlyStopping,omitempty"`

pkg/apis/controller/trials/v1beta1/trial_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type TrialSpec struct {
2929
Objective *common.ObjectiveSpec `json:"objective,omitempty"`
3030

3131
// Key-value pairs for hyperparameters and assignment values.
32-
ParameterAssignments []common.ParameterAssignment `json:"parameterAssignments"`
32+
ParameterAssignments []common.ParameterAssignment `json:"parameterAssignments,omitempty"`
3333

3434
// Rules for early stopping techniques.
3535
// Each rule should be met to early stop Trial.

pkg/apis/v1beta1/openapi_generated.go

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

pkg/apis/v1beta1/swagger.json

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@
102102
".v1beta1.SuggestionSpec": {
103103
"description": "SuggestionSpec is the specification of a Suggestion.",
104104
"type": "object",
105-
"required": [
106-
"algorithm"
107-
],
108105
"properties": {
109106
"algorithm": {
110107
"description": "Algorithm describes HP or NAS algorithm that suggestion is used.",
@@ -293,9 +290,6 @@
293290
".v1beta1.TrialSpec": {
294291
"description": "TrialSpec is the specification of a Trial.",
295292
"type": "object",
296-
"required": [
297-
"parameterAssignments"
298-
],
299293
"properties": {
300294
"earlyStoppingRules": {
301295
"description": "Rules for early stopping techniques. Each rule should be met to early stop Trial.",
@@ -416,17 +410,13 @@
416410
},
417411
"v1beta1.CollectorSpec": {
418412
"type": "object",
419-
"required": [
420-
"kind"
421-
],
422413
"properties": {
423414
"customCollector": {
424415
"description": "When kind is \"customCollector\", this field will be used",
425416
"$ref": "#/definitions/v1.Container"
426417
},
427418
"kind": {
428-
"type": "string",
429-
"default": ""
419+
"type": "string"
430420
}
431421
}
432422
},
@@ -929,9 +919,6 @@
929919
},
930920
"v1beta1.Observation": {
931921
"type": "object",
932-
"required": [
933-
"metrics"
934-
],
935922
"properties": {
936923
"metrics": {
937924
"description": "Key-value pairs for metric names and values",
@@ -962,15 +949,10 @@
962949
"v1beta1.OptimalTrial": {
963950
"description": "OptimalTrial is the metrics and assignments of the best trial.",
964951
"type": "object",
965-
"required": [
966-
"bestTrialName",
967-
"parameterAssignments"
968-
],
969952
"properties": {
970953
"bestTrialName": {
971954
"description": "BestTrialName is the name of the best trial.",
972-
"type": "string",
973-
"default": ""
955+
"type": "string"
974956
},
975957
"observation": {
976958
"description": "Observation for this trial",

sdk/python/v1beta1/docs/V1beta1CollectorSpec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Name | Type | Description | Notes
55
------------ | ------------- | ------------- | -------------
66
**custom_collector** | [**V1Container**](https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1Container.md) | | [optional]
7-
**kind** | **str** | | [default to '']
7+
**kind** | **str** | | [optional]
88

99
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1010

sdk/python/v1beta1/docs/V1beta1Observation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Properties
44
Name | Type | Description | Notes
55
------------ | ------------- | ------------- | -------------
6-
**metrics** | [**list[V1beta1Metric]**](V1beta1Metric.md) | Key-value pairs for metric names and values |
6+
**metrics** | [**list[V1beta1Metric]**](V1beta1Metric.md) | Key-value pairs for metric names and values | [optional]
77

88
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
99

sdk/python/v1beta1/docs/V1beta1OptimalTrial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ OptimalTrial is the metrics and assignments of the best trial.
44
## Properties
55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
7-
**best_trial_name** | **str** | BestTrialName is the name of the best trial. | [default to '']
7+
**best_trial_name** | **str** | BestTrialName is the name of the best trial. | [optional]
88
**observation** | [**V1beta1Observation**](V1beta1Observation.md) | | [optional]
9-
**parameter_assignments** | [**list[V1beta1ParameterAssignment]**](V1beta1ParameterAssignment.md) | Key-value pairs for hyperparameters and assignment values. |
9+
**parameter_assignments** | [**list[V1beta1ParameterAssignment]**](V1beta1ParameterAssignment.md) | Key-value pairs for hyperparameters and assignment values. | [optional]
1010

1111
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1212

sdk/python/v1beta1/docs/V1beta1SuggestionSpec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ SuggestionSpec is the specification of a Suggestion.
44
## Properties
55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
7-
**algorithm** | [**V1beta1AlgorithmSpec**](V1beta1AlgorithmSpec.md) | |
7+
**algorithm** | [**V1beta1AlgorithmSpec**](V1beta1AlgorithmSpec.md) | | [optional]
88
**early_stopping** | [**V1beta1EarlyStoppingSpec**](V1beta1EarlyStoppingSpec.md) | | [optional]
99
**requests** | **int** | Number of suggestions requested. | [optional]
1010
**resume_policy** | **str** | ResumePolicy describes resuming policy which usually take effect after experiment terminated. Default value is LongRunning. | [optional]

0 commit comments

Comments
 (0)