FasterXML / FasterXML/jackson-module-kotlin
Feature flag to serialize unitialized lateinit properties into null
- Dominant language
- Kotlin
- Stars
- 1.2k
- Forks
- 187
- Avg merge
- 9h 48m
- Merged PRs (30d)
- 16
Description
### Use case
We log entity classes before saving them to the database
```
data class MyEntity(
val text: String,
... other required properties
) {
lateinit var createAt: Instant // this field is initialized after the entity is saved to the Database
}
fun save(entity: MyEntity) {
log.info("About to save ${objectMapper.writeValueAsString(entity)}")
repository.save(entity)
}
```
### Describe the solution you'd like
A new feature flag
```
val module = KotlinModule.Builder()
.configure(KotlinFeature.UnintializedLateInitToNull, true) // to write them as nulls
.configure(KotlinFeature.UnintializedLateInitToIgnore, true) // or to avoid them
.build()
```
### Describe alternatives you've considered
_No response_
### Additional context
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.