Replies: 3 comments
-
Structural schemas are not supported yet via The relevant issue is in GREsau/schemars#84 I have not had much time to dig into this so that's all I got atm. |
Beta Was this translation helpful? Give feedback.
-
The generated schema is not guaranteed to be structural at the moment because it's Kubernetes specific and we're using general schmema derive. I haven't fully understood the requirements either. As far as I know, none of Go frameworks support generating structural schema. Maybe https://pkg.go.dev/k8s.io/apiextensions-apiserver/pkg/apiserver/schema can help us understand the requirements, and possibly transform the schema. See #398 (comment) and possible workaround #398 (comment) |
Beta Was this translation helpful? Give feedback.
-
For future reference, there's work on this in #779 |
Beta Was this translation helpful? Give feedback.
-
Given this Cargo.toml
This program:
Which produces this CRD definition:
When applying the CRD yaml to a 1.21 kind cluster I get the following error:
I have a hard time understanding OpenAPI in general, and the constraints given by https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#specifying-a-structural-schema but the operative constraint appears to be:
Does this restriction mean that Rust's algebraic-type enums (i.e. Enum variants with values in them) are explicitly unsupported by k8s? Or is there a way to express what I'm trying to express in a way that k8s will allow and validate? If it is the former (explicitly unsupported), could one of the derive macros raise an error instead of producing the invalid yaml?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions