timoni icon indicating copy to clipboard operation
timoni copied to clipboard

Schema error on object type from imported CRD

Open markphillips100 opened this issue 4 months ago • 1 comments

Pretty new to timoni and cue so still learning. I've a validation issue that occurs from running timoni mod vet related to the following setup. Whilst it is a schema error, I am uncertain if the CRD itself is at fault or the underlying cue generation.

The Problem I see pretty much exactly what is described in issue #278 . Generated properties for type "object" result in a {} rather than {...} being assigned. I only conclude this as I'm using this repo as a reference and its generated object properties are using the latter syntax with no schema errors. Example here

My Setup timoni version: api: timoni.sh/v1alpha1 client: 0.19.0 cue: 0.7.0

  1. Fetch Crossplane master
  2. Import CRD yaml: timoni mod vendor crds -f <repo>\cluster\crds\apiextensions.crossplane.io_composition.yaml
  3. Define a minimal schema to use a Composition schema from api "apiextensions.crossplane.io/composition/v1". Relevant CRD and schema code below. The error is related to a property defined as input?: {} in the generated schema.

CRD defines "input" as:

input:
   description: |-
      Input is an optional, arbitrary Kubernetes resource (i.e. a resource
      with an apiVersion and kind) that will be passed to the Composition
      Function as the 'input' of its RunFunctionRequest.
   type: object
   x-kubernetes-embedded-resource: true
   x-kubernetes-preserve-unknown-fields: true

Minimal schema to reproduce error:

package templates

import (
	crossplane "apiextensions.crossplane.io/composition/v1"
)

#SampleComposition: crossplane.#Composition & {
    spec: {
		pipeline: [
			{
				input: {
					apiVersion: "pt.fn.crossplane.io/v1beta1"
				}
			}
		]
    }
}

markphillips100 avatar Feb 29 '24 04:02 markphillips100