Skip to content

Conversation

@ZacSweers
Copy link
Collaborator

@ZacSweers ZacSweers commented Nov 24, 2025

Details in the changelog, but in short this unlocks the ability to match behavior like kotlinx.serialization's support for inlining the single value in JSON.

One primary question here is: what do we do about default values in this scenario? Right now it doesn't support absence

A secondary question could be to make this its own @JsonInline annotation rather than part of @JsonClass

@ZacSweers ZacSweers requested a review from swankjesse November 24, 2025 23:02
Copy link
Collaborator

@swankjesse swankjesse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it’s ambiguous in the case where the property is nullable?

@JsonClass(generateAdapter = true, inline = true)
data class Location(val point: Point?)

Decoding [null] as a List<Location?> could be listOf(Location(null)) or listOf(null).

I think we gotta make a call here!

}

@Test
fun inlineClassWithMultiplePropertiesFails() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@ZacSweers
Copy link
Collaborator Author

Prohibited nullable props in 24d409a

@ZacSweers ZacSweers requested a review from swankjesse November 25, 2025 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants