FasterXML / FasterXML/jackson-module-kotlin
Way to ignore properties from delegate
- Dominant language
- Kotlin
- Stars
- 1.2k
- Forks
- 187
- Avg merge
- 9h 48m
- Merged PRs (30d)
- 16
Description
Hi, consider following code:
```kotlin
data class Base(
@JsonProperty("prop1") val prop1: String,
@JsonProperty("prop2") val prop2: String
)
data class Specific(
@JsonProperty("baseProps") val baseProps: Base,
@JsonProperty("prop3") val prop3: String
) : Base by baseProps
```
When using `objectMapper.writeValueAsString(specific)`, result JSON looks like this:
```json
{
"@type": "Specific",
"baseProps": {
"@type": "Base",
"prop1": "value1",
"prop2": "value2"
},
"prop1": "value1",
"prop2": "value2",
"prop3": "value3"
}
```
Is there a way to ignore all delegated properties from delegate `Base` without specifying every one of them using `@JsonIgnoreProperties`? Something like `@JsonIgnoreDelegates("baseProps")` would be great. The result should look like this:
```json
{
"@type": "Specific",
"baseProps": {
"@type": "Base",
"prop1": "value1",
"prop2": "value2"
},
"prop3": "value3"
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.