examples-generated contain fields with wrong type
- Dominant language
- Go
- Stars
- 481
- Forks
- 131
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 11
Description
### What happened?
When generating an example yaml in `examples-generated` the expectation is that the type of the fields matches the type of the fields in the corresponding generated CRD. However, when generating a `provider-datadog`, the generated CRD for `package/crds/monitor.datadog.upbound.io_monitors.yaml` includes the expected type string for the following `monitorThresholds` numbers:
```
161 monitorThresholds:
162 description: '(Block List, Max: 1) Alert thresholds of the monitor.
163 (see below for nested schema) Alert thresholds of the monitor.'
164 items:
165 properties:
166 critical:
167 description: (String) The monitor CRITICAL threshold. Must
168 be a number. The monitor `CRITICAL` threshold. Must be
169 a number.
170 type: string
171 criticalRecovery:
172 description: (String) The monitor CRITICAL recovery threshold.
173 Must be a number. The monitor `CRITICAL` recovery threshold.
174 Must be a number.
175 type: string
176 ok:
177 description: (String) The monitor OK threshold. Only supported
178 in monitor type service check. Must be a number. The monitor
179 `OK` threshold. Only supported in monitor type `service
180 check`. Must be a number.
181 type: string
182 unknown:
183 description: (String) The monitor UNKNOWN threshold. Only
184 supported in monitor type service check. Must be a number.
185 The monitor `UNKNOWN` threshold. Only supported in monitor
186 type `service check`. Must be a number.
187 type: string
188 warning:
189 description: (String) The monitor WARNING threshold. Must
190 be a number. The monitor `WARNING` threshold. Must be
191 a number.
192 type: string
193 warningRecovery:
194 description: (String) The monitor WARNING recovery threshold.
195 Must be a number. The monitor `WARNING` recovery threshold.
196 Must be a number.
197 type: string
```
Yet the `examples-generated/monitor/monitor.yaml`, uses integers for those fields per below:
```
apiVersion: monitor.datadog.upbound.io/v1alpha1
kind: Monitor
metadata:
annotations:
meta.upbound.io/example-id: monitor/v1alpha1/monitor
labels:
testing.upbound.io/example-name: foo
name: foo
spec:
forProvider:
escalationMessage: Escalation message @pagerduty
includeTags: true
message: 'Monitor triggered. Notify: @hipchat-channel'
monitorThresholds:
- critical: 4
warning: 2
name: Name for monitor foo
query: avg(last_1h):avg:aws.ec2.cpu{environment:foo,host:foo} by {host} > 4
tags:
- foo:bar
- team:fooBar
type: metric alert
```
When changing the example manually to use strings like below, resources are created.
```
monitorThresholds:
- critical: "4"
warning: "2"
```
How can Upjet be directed to create examples with matching types?
### How can we reproduce it?
This can be reproduced as follows:
```
- git clone git@github.com:upbound/provider-datadog.git
- git checkout bootstrap
- make submodules
- make clean; make gen-clean; make generate
```
Compare the types of `examples-generated/monitor/monitor.yaml` and `package/crds/monitor.datadog.upbound.io_monitors.yaml` for `monitorThresholds` fields.
Contributor guide
Assessment
This issue has not been assessed yet.