org.yaml.snakeyaml.introspector Failed to find field for <propertyName>
I had understood--apparently incorrectly--that SnakeYAML would detect a bean property (with appropriate setter and getter methods defined on the interface) and treat such a bean property as a property for the purposes of `addPropertyParameters`.
But it does not, and I see in the source code why: `PropertySubstitute#setTargetType)` invokes `Class#getDeclaredFields` which, of course, does not return instance fields for the bean properties because there are no instance fields on the interface.
And `setTargetType` also does not search for setter methods that would also identify the property of interest.
How can we accomplish what we want without triggering the warning messages?
Thanks.
- Tim
Hi,
there are similar warning in the Kubernetes Java client, as discussed in this github issue.
Schema classes are automatically generated based on upstream Kubernetes JSON.
public class V1JSONSchemaProps {public static final String SERIALIZED_NAME_X_KUBERNETES_INT_OR_STRING = "x-kubernetes-int-or-string";
@SerializedName(SERIALIZED_NAME_X_KUBERNETES_INT_OR_STRING)
private Boolean xKubernetesIntOrString;
}When we register custom TypeDescriptions
TypeDescription.substituteProperty("x-kubernetes-int-or-string", field.getType(), getterMethod.getName(), setterMethod.getName());We encounter this warning:
Failed to find field for io.kubernetes.client.openapi.models.V1JSONSchemaProps.x-kubernetes-int-or-string Jul 27, 2023 1:23:33 PM org.yaml.snakeyaml.internal.Logger warnwarning is obvious as V1JSONSchemaProps has field "xKubernetesIntOrString" but not "x-kubernetes-int-or-string"
However, the actual implementation works correctly—the field "x-kubernetes-int-or-string" appears in the YAML, and since the corresponding getter and setter are properly defined, it gets mapped correctly.
Would you have any suggestions on how to suppress this warning?