File: union.go

package info (click to toggle)
golang-k8s-kube-openapi 0.0~git20241212.2c72e55-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 23,396 kB
  • sloc: sh: 50; makefile: 5
file content (44 lines) | stat: -rw-r--r-- 830 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package uniontype

// +k8s:openapi-gen=true
type TopLevelUnion struct {
	Name string `json:"name"`

	Union `json:",inline"`
}

// +k8s:openapi-gen=true
// +union
type Union struct {
	// +unionDiscriminator
	// +optional
	UnionType string `json:"unionType"`

	FieldA int `json:"fieldA,omitempty"`
	FieldB int `json:"fieldB,omitempty"`
}

// +k8s:openapi-gen=true
type Union2 struct {
	// +unionDiscriminator
	Type string `json:"type"`
	// +unionDeprecated
	Alpha int `json:"alpha,omitempty"`
	// +unionDeprecated
	Beta int `json:"beta,omitempty"`
}

// +k8s:openapi-gen=true
type InlinedUnion struct {
	Name string `json:"name"`

	// +unionDeprecated
	// +optional
	Field1 *int `json:"field1,omitempty"`
	// +unionDeprecated
	// +optional
	Field2 *int `json:"field2,omitempty"`

	Union  `json:",inline"`
	Union2 `json:",inline"`
}