| 1 |
package defaults |
| 2 |
|
| 3 |
// +k8s:openapi-gen=true |
| 4 |
type Defaulted struct { |
| 5 |
// +default="bar" |
| 6 |
Field string `json:"Field,omitempty"` |
| 7 |
// +default=0 |
| 8 |
OtherField int |
| 9 |
// +default=["foo", "bar"] |
| 10 |
List []Item |
| 11 |
// +default={"S": "foo", "I": 5} |
| 12 |
Sub *SubStruct |
| 13 |
|
| 14 |
OtherSub SubStruct |
| 15 |
|
| 16 |
// +default={"foo": "bar"} |
| 17 |
Map map[string]Item |
| 18 |
|
| 19 |
// +default=ref(ConstantValue) |
| 20 |
LocalSymbolReference string `json:"localSymbolReference,omitempty"` |
| 21 |
// +default=ref(k8s.io/kube-openapi/test/integration/testdata/defaults.ConstantValue) |
| 22 |
FullyQualifiedSymbolReference string `json:"fullyQualifiedSymbolReference,omitempty"` |
| 23 |
// +default=ref(k8s.io/kube-openapi/test/integration/testdata/enumtype.FruitApple) |
| 24 |
ExternalSymbolReference string `json:"externalSymbolReference,omitempty"` |
| 25 |
// +default=ref(k8s.io/kube-openapi/test/integration/testdata/enumtype.FruitApple) |
| 26 |
PointerConversionSymbolReference *DefaultedItem `json:"pointerConversionSymbolReference,omitempty"` |
| 27 |
DefaultedAliasSymbolReference DefaultedItem `json:"defaultedAliasSymbolReference,omitempty"` |
| 28 |
} |
| 29 |
|
| 30 |
const ConstantValue string = "SymbolConstant" |
| 31 |
|
| 32 |
// +default=ref(ConstantValue) |
| 33 |
type DefaultedItem string |
| 34 |
|
| 35 |
// +k8s:openapi-gen=true |
| 36 |
type Item string |
| 37 |
|
| 38 |
// +k8s:openapi-gen=true |
| 39 |
type SubStruct struct { |
| 40 |
S string |
| 41 |
// +default=1 |
| 42 |
I int `json:"I,omitempty"` |
| 43 |
} |