From f5c1aa8517d968f7c862f298dd85fd39ca305672 Mon Sep 17 00:00:00 2001 From: Marc Nuri Date: Thu, 27 Jun 2024 11:47:19 +0200 Subject: [PATCH] fix: don't annotate getter or setters, JsonProperty already in field Signed-off-by: Marc Nuri --- .../KubernetesCoreTypeAnnotator.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/kubernetes-model-generator/kubernetes-model-jsonschema2pojo/src/main/java/io/fabric8/kubernetes/jsonschema2pojo/KubernetesCoreTypeAnnotator.java b/kubernetes-model-generator/kubernetes-model-jsonschema2pojo/src/main/java/io/fabric8/kubernetes/jsonschema2pojo/KubernetesCoreTypeAnnotator.java index 59773db08a7..5014b9394c8 100644 --- a/kubernetes-model-generator/kubernetes-model-jsonschema2pojo/src/main/java/io/fabric8/kubernetes/jsonschema2pojo/KubernetesCoreTypeAnnotator.java +++ b/kubernetes-model-generator/kubernetes-model-jsonschema2pojo/src/main/java/io/fabric8/kubernetes/jsonschema2pojo/KubernetesCoreTypeAnnotator.java @@ -227,6 +227,28 @@ public void propertyField(JFieldVar field, JDefinedClass clazz, String propertyN } } + @Override + public void propertyGetter(JMethod getter, JDefinedClass clazz, String propertyName) { + // https://github.com/fabric8io/kubernetes-client/issues/6085 + // https://github.com/quarkusio/quarkus/issues/39934 + // Having JsonProperty in both field and method causes issues when compiling to native + // ignore for x-kubernetes-* properties (require special handling) + if (propertyName.startsWith("x-kubernetes-")) { + super.propertyGetter(getter, clazz, propertyName); + } + } + + @Override + public void propertySetter(JMethod setter, JDefinedClass clazz, String propertyName) { + // https://github.com/fabric8io/kubernetes-client/issues/6085 + // https://github.com/quarkusio/quarkus/issues/39934 + // Having JsonProperty in both field and method causes issues when compiling to native + // ignore for x-kubernetes-* properties (require special handling) + if (propertyName.startsWith("x-kubernetes-")) { + super.propertySetter(setter, clazz, propertyName); + } + } + protected void processBuildable(JDefinedClass clazz) { JAnnotationUse buildable = clazz.annotate(Buildable.class) .param("editableEnabled", false)