Skip to content

Commit fcd3fd6

Browse files
committed
refactor(csv): don't use pointers for rawmessage fields
Prevents fields of type *json.RawMessage from causing controller-gen to output bad deepcopy types by switching to json.RawMessage. The underlying type is []byte, so the fields remain semantically equivalent.
1 parent 4c210f0 commit fcd3fd6

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

pkg/operators/clusterserviceversion_types.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ type StatusDescriptor struct {
7777
DisplayName string
7878
Description string
7979
XDescriptors []string
80-
Value *json.RawMessage
80+
Value json.RawMessage
8181
}
8282

8383
// SpecDescriptor describes a field in a spec block of a CRD so that OLM can consume it
@@ -86,7 +86,7 @@ type SpecDescriptor struct {
8686
DisplayName string
8787
Description string
8888
XDescriptors []string
89-
Value *json.RawMessage
89+
Value json.RawMessage
9090
}
9191

9292
// ActionDescriptor describes a declarative action that can be performed on a custom resource instance
@@ -95,7 +95,7 @@ type ActionDescriptor struct {
9595
DisplayName string
9696
Description string
9797
XDescriptors []string
98-
Value *json.RawMessage
98+
Value json.RawMessage
9999
}
100100

101101
// CRDDescription provides details to OLM about the CRDs

pkg/operators/v1alpha1/clusterserviceversion_types.go

+15-15
Original file line numberDiff line numberDiff line change
@@ -77,31 +77,31 @@ func (d *StrategyDetailsDeployment) GetStrategyName() string {
7777
// StatusDescriptor describes a field in a status block of a CRD so that OLM can consume it
7878
// +k8s:openapi-gen=true
7979
type StatusDescriptor struct {
80-
Path string `json:"path"`
81-
DisplayName string `json:"displayName,omitempty"`
82-
Description string `json:"description,omitempty"`
83-
XDescriptors []string `json:"x-descriptors,omitempty"`
84-
Value *json.RawMessage `json:"value,omitempty"`
80+
Path string `json:"path"`
81+
DisplayName string `json:"displayName,omitempty"`
82+
Description string `json:"description,omitempty"`
83+
XDescriptors []string `json:"x-descriptors,omitempty"`
84+
Value json.RawMessage `json:"value,omitempty"`
8585
}
8686

8787
// SpecDescriptor describes a field in a spec block of a CRD so that OLM can consume it
8888
// +k8s:openapi-gen=true
8989
type SpecDescriptor struct {
90-
Path string `json:"path"`
91-
DisplayName string `json:"displayName,omitempty"`
92-
Description string `json:"description,omitempty"`
93-
XDescriptors []string `json:"x-descriptors,omitempty"`
94-
Value *json.RawMessage `json:"value,omitempty"`
90+
Path string `json:"path"`
91+
DisplayName string `json:"displayName,omitempty"`
92+
Description string `json:"description,omitempty"`
93+
XDescriptors []string `json:"x-descriptors,omitempty"`
94+
Value json.RawMessage `json:"value,omitempty"`
9595
}
9696

9797
// ActionDescriptor describes a declarative action that can be performed on a custom resource instance
9898
// +k8s:openapi-gen=true
9999
type ActionDescriptor struct {
100-
Path string `json:"path"`
101-
DisplayName string `json:"displayName,omitempty"`
102-
Description string `json:"description,omitempty"`
103-
XDescriptors []string `json:"x-descriptors,omitempty"`
104-
Value *json.RawMessage `json:"value,omitempty"`
100+
Path string `json:"path"`
101+
DisplayName string `json:"displayName,omitempty"`
102+
Description string `json:"description,omitempty"`
103+
XDescriptors []string `json:"x-descriptors,omitempty"`
104+
Value json.RawMessage `json:"value,omitempty"`
105105
}
106106

107107
// CRDDescription provides details to OLM about the CRDs

0 commit comments

Comments
 (0)