Debian Codegraph @

test/integration/testdata/uniontype/union.go

raw
1 package uniontype
2
3 // +k8s:openapi-gen=true
4 type TopLevelUnion struct {
5 Name string `json:"name"`
6
7 Union `json:",inline"`
8 }
9
10 // +k8s:openapi-gen=true
11 // +union
12 type Union struct {
13 // +unionDiscriminator
14 // +optional
15 UnionType string `json:"unionType"`
16
17 FieldA int `json:"fieldA,omitempty"`
18 FieldB int `json:"fieldB,omitempty"`
19 }
20
21 // +k8s:openapi-gen=true
22 type Union2 struct {
23 // +unionDiscriminator
24 Type string `json:"type"`
25 // +unionDeprecated
26 Alpha int `json:"alpha,omitempty"`
27 // +unionDeprecated
28 Beta int `json:"beta,omitempty"`
29 }
30
31 // +k8s:openapi-gen=true
32 type InlinedUnion struct {
33 Name string `json:"name"`
34
35 // +unionDeprecated
36 // +optional
37 Field1 *int `json:"field1,omitempty"`
38 // +unionDeprecated
39 // +optional
40 Field2 *int `json:"field2,omitempty"`
41
42 Union `json:",inline"`
43 Union2 `json:",inline"`
44 }