You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a CustomResourceDefinition defines a default value for a field, the generated code fails to inject that value, generating a ClassCastException whenever the generated class is instantiated.
For example, if the CRD has the following snippet:
properties:
caCertKey:
default: ca.cert
description: The key in the Secret that provides the Certificate Authority (CA) X509 certificate bundle.
type: string
then this will generate the following Java code snippet:
/**
* The key in the Secret that provides the Certificate Authority (CA) X509 certificate bundle.
*/
@com.fasterxml.jackson.annotation.JsonProperty("caCertKey")
@com.fasterxml.jackson.annotation.JsonPropertyDescription("The key in the Secret that provides the Certificate Authority (CA) X509 certificate bundle.")
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SKIP)
private String caCertKey = io.fabric8.kubernetes.client.utils.Serialization.unmarshal("\"ca.cert\"", String.class);
The call to Serialization.unmarshal() always generates the following stacktrace:
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map
at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:237)
at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:360)
at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:296)
at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:281)
at my.organization.v1beta1.TlsConfig.<init>(TlsConfig.java:14)
...
Fabric8 Kubernetes Client version
6.1.1
Steps to reproduce
Generate Java code for a CustomResourceDefinition that defines a default value for some field.
Try to instantiate the generated Java class, e.g. by simply invoking new TlsConfig() for the example above. This will fail with a ClassCastException.
Expected behavior
It should be possible to instantiate the Java class for the CustomResourceDefinition.
Runtime
other (please specify in additional context)
Kubernetes API Server version
other (please specify in additional context)
Environment
macOS
Fabric8 Kubernetes Client Logs
No response
Additional context
Runtime and Kubernetes API versions are not relevant. This is just a Java generator issue.
The text was updated successfully, but these errors were encountered:
Describe the bug
If a CustomResourceDefinition defines a default value for a field, the generated code fails to inject that value, generating a ClassCastException whenever the generated class is instantiated.
For example, if the CRD has the following snippet:
then this will generate the following Java code snippet:
The call to
Serialization.unmarshal()
always generates the following stacktrace:Fabric8 Kubernetes Client version
6.1.1
Steps to reproduce
new TlsConfig()
for the example above. This will fail with a ClassCastException.Expected behavior
It should be possible to instantiate the Java class for the CustomResourceDefinition.
Runtime
other (please specify in additional context)
Kubernetes API Server version
other (please specify in additional context)
Environment
macOS
Fabric8 Kubernetes Client Logs
No response
Additional context
Runtime and Kubernetes API versions are not relevant. This is just a Java generator issue.
The text was updated successfully, but these errors were encountered: