FasterXML / FasterXML/jackson-databind

@JsonIgnoreProperties does not stack

Aperta
#1,037 10 commenti 1 reazione 0 assegnatari Vedi su GitHub
3.x
Lingua principale
Java
Stelle
3.7k
Fork
1.5k
Merge medio
3g 6h
PR unite (30g)
28

Descrizione

I'd like to be able to aggregate `@JsonIgnoreProperties`, but it looks like it's only accepting the "top" one.

Here's a test case:

```
@JsonIgnoreProperties(value = { "generated" }, allowGetters = true)
static class BaseBean {
public String getGenerated() {
return "http://bar.com";
}
}

@JsonIgnoreProperties(value = { "computed" }, allowGetters = true)
static class ReadOnlyBean extends BaseBean {
public int getComputed() {
return 32;
}
}

@Test
public void testReadOnlyProp() throws Exception {

ObjectMapper m = new ObjectMapper();
String json = m.writeValueAsString(new ReadOnlyBean());
assertTrue(json.contains("generated"));
assertTrue(json.contains("computed"));
ReadOnlyBean bean = m.readValue(json, ReadOnlyBean.class);
assertNotNull(bean);
}
```

When the `@JsonIgnoreProperties` is on a mixin, the mixin's annotation trumps all.

Would it be possible to aggregate all the `@JsonIgnoreProperties`?

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.