Description of the bug:
I'm facing something similar to #1291 with Crossplane.
Crossplane CompositeResourceDefinition (XRD) CRD defines openAPIV3Schema as a type: object, which results in an empty object synthesis and plain interface{} generation.
So, for a crossplane XRD, this
Versions: &([]*xrd.CompositeResourceDefinitionSpecVersions{{
Name: jsii.String("v1alpha1"),
Referenceable: jsii.Bool(true),
Served: jsii.Bool(true),
Schema: &xrd.CompositeResourceDefinitionSpecVersionsSchema{
OpenApiv3Schema: &k8s.JsonSchemaProps{
Type: jsii.String("Object"),
},
},
}}),
CRD codegen gives an interface{} for a type: object schema
properties:
openAPIV3Schema:
description: OpenAPIV3Schema is the OpenAPI v3 schema to use for validation and pruning.
type: object
x-kubernetes-preserve-unknown-fields: true
type CompositeResourceDefinitionSpecVersionsSchema struct {
// OpenAPIV3Schema is the OpenAPI v3 schema to use for validation and pruning.
OpenApiv3Schema interface{} `field:"optional" json:"openApiv3Schema" yaml:"openApiv3Schema"`
}
it synthesizes just an empty object {}, disregarding the contents
versions:
- name: v1alpha1
referenceable: true
schema:
openAPIV3Schema: {}
served: true
It should be possible to cast existing struct to interface{}, or at least convert it to mapstructure as map[string]interface{} using the respective yaml reflection tags out of the existing k8s JsonSchemaProps, to overcome this. But I'd like a bit more concise solution, or at least an exception During Synthesis, instead of an empty output.
Reproduction Steps:
- Import a CRD schema with
type: object which would generate interface{}
- Pass a
struct{} with something there
- Get empty output during synthesis
Environment:
- github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2 v2.7.59
- github.com/aws/jsii-runtime-go v1.81.0
- github.com/aws/constructs-go/constructs/v10 v10.2.20
This is 🐛 Bug Report
Description of the bug:
I'm facing something similar to #1291 with Crossplane.
Crossplane CompositeResourceDefinition (XRD) CRD defines openAPIV3Schema as a
type: object, which results in an empty object synthesis and plaininterface{}generation.So, for a crossplane XRD, this
CRD codegen gives an
interface{}for atype: objectschemait synthesizes just an empty object
{}, disregarding the contentsIt should be possible to cast existing
structtointerface{}, or at least convert it tomapstructureasmap[string]interface{}using the respective yaml reflection tags out of the existing k8s JsonSchemaProps, to overcome this. But I'd like a bit more concise solution, or at least an exception During Synthesis, instead of an empty output.Reproduction Steps:
type: objectwhich would generateinterface{}struct{}with something thereEnvironment:
This is 🐛 Bug Report