Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema error on object type from imported CRD #353

Open
markphillips100 opened this issue Feb 29, 2024 · 1 comment
Open

Schema error on object type from imported CRD #353

markphillips100 opened this issue Feb 29, 2024 · 1 comment

Comments

@markphillips100
Copy link

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
Copy link
Author

Not sure if this is related but I also don't see an actual schema defined when a Crossplane CompositeResourceDefinition CRD is imported either. The CRD defines openAPIV3Schema as shown here and yet the cue type produces openApiV3Schema?: {} which again causes mod validation errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant