timoni icon indicating copy to clipboard operation
timoni copied to clipboard

Incorrect CRD spec generation

Open holycheater opened this issue 2 months ago • 0 comments

When spec is generated from object with no properties, it creates a closed struct inside a "definition" which doesn't allow to extend objects

Example CRD: https://github.com/Altinity/clickhouse-operator/blob/master/deploy/operatorhub/0.23.5/clickhouseinstallations.clickhouse.altinity.com.crd.yaml#L1112-L1118

example result:

#ClickHouseInstallationSpec: {
  // ... skip ...
  spec: podTemplates?: [...{
    // ... skip ...
   metadata?: {}
}


obj: #ClickHouseInstallationSpec
obj: templates: podTemplates: [{
    metadata: labels: foo: "bar"
}]

Error:

obj.spec.templates.podTemplates.0.metadata.labels: field not allowed:
    ../cue.mod/gen/clickhouse.altinity.com/clickhouseinstallation/v1/types_gen.cue:45:9
    ../cue.mod/gen/clickhouse.altinity.com/clickhouseinstallation/v1/types_gen.cue:1210:19
    ../cue.mod/gen/clickhouse.altinity.com/clickhouseinstallation/v1/types_gen.cue:1223:15

holycheater avatar Apr 25 '24 16:04 holycheater