-
Notifications
You must be signed in to change notification settings - Fork 100
Update Jackson to 2.18.4 #8449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: staging
Are you sure you want to change the base?
Update Jackson to 2.18.4 #8449
Conversation
// note: "" deserializes to com.fasterxml.jackson.databind.node.MissingNode, | ||
// which causes NPE when using Jackson 2.18.3+, because from this version on it decodes to null | ||
val schemaForPlain: OpenAPIJsonSchema = OpenAPIJsonSchema("") | ||
val schemaForJson: OpenAPIJsonSchema = OpenAPIJsonSchema("{}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, do we even need these two schemas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, yes:
class UniversalSchemaSupportDispatcher private (kafkaConfig: KafkaConfig) {
...
def forParsedSchema(parsedSchema: ParsedSchema): UniversalSchemaSupport = parsedSchema match {
// For ad hoc tests we want to present the user with json editor when topic has no schema and content type Json was selected
case ContentTypesSchemas.schemaForJson => NoSchemaJsonSupport
case _ => forSchemaType(parsedSchema.schemaType())
}
// which causes NPE when using Jackson 2.18.3+, because from this version on it decodes to null | ||
val schemaForPlain: OpenAPIJsonSchema = OpenAPIJsonSchema("") | ||
val schemaForJson: OpenAPIJsonSchema = OpenAPIJsonSchema("{}") | ||
val schemaForPlain: OpenAPIJsonSchema = OpenAPIJsonSchema("true") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure about this? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's that or some heavier refactoring. true
after parsing results in the same schema: {}
. An alternative would be to use {}
({}
with some whitespace around) with custom equals
method for OpenAPIJsonSchema
.
I mention custom equals
because OpenAPIJsonSchema
is a fake case class - default Scala's equals
for case classes doesn't work there, it's implemented like this:
test("boxes are equal") {
class BoxParent {
override def equals(obj: Any): Boolean = true
override def hashCode(): Int = 0
}
case class Box(v: String) extends BoxParent
// this equality is true in Scala, but not in real world
Box("socks") shouldBe Box("gold")
}
Describe your changes
TODO: solve Jackson incompatibility by removing changes from #7066. To sum up Slack discussion:
Checklist before merge