CRD generator doesn't respect Jackson serialization/deserialization
See original GitHub issueDescribe the bug
Having a Java class that defines:
private String myTest = null;
public String getTest() {
return myTest;
}
generates a CRD with the following:
myTest:
type: string
But when trying to read a corresponding CR from Kubernetes fails with the following:
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "myTest" , not marked as ignorable
Fabric8 Kubernetes Client version
5.10.1@latest
Steps to reproduce
Try to read a CR using the kubernetes-client
where the Jackson serialization have a mismatch with the name of the fields.
The viable workaround is to annotate the field to respect the generate CRD name e.g.:
@JsonProperty("myTest")
private String myTest = null;
public String getTest() {
return myTest;
}
Expected behavior
The generated CRD should respect the Jackson serialization/deserialization informations.
In general it should be possible to have a clean round-trip for arbitrary Java classes:
Java -> CRD -> CR in Kubernetes -> client reads the CR
Runtime
Kubernetes (vanilla), other (please specify in additional context)
Kubernetes API Server version
1.22.3@latest
Environment
Linux, other (please specify in additional context)
Fabric8 Kubernetes Client Logs
No response
Additional context
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Deserialization doesn't seem to respect @JsonIgnore
Serialization works fine and ObjectList.json looks okay. When I try to read this file and deserialize I get the exception above. For some...
Read more >InstantSerializer doesn't respect any format-related settings ...
InstantSerializer doesn't respect any of the following standard Jackson configuration settings: ObjectMapper#setDateFormat ...
Read more >Map Serialization and Deserialization with Jackson - Baeldung
A quick and practical guide to serializing and deserializing Java Maps using Jackson.
Read more >MessagePack: It's like JSON. but fast and small.
It's like JSON. but fast and small. MessagePack is an efficient binary serialization format. It lets you exchange data among multiple languages like...
Read more >Java and JSON – Jackson Serialization with ObjectMapper
This guide contains examples that show you how to serialize and deserialize from Java to JSON. It covers the basics and the most...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It only creates one property. I agree that using
JsonProperty
annotation makes the intent much clearer.I think that the available workaround make this issue pretty low in priority, I opened it mostly for tracking purposes.
I believe that we should somehow document what the generator takes in consideration (currently
JsonProperty
,JsonPropertyDescription
andNotNull
) so that we settle the right expectations.This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!