FasterXML / jackson-annotations

Core annotations (annotations that only depend on jackson-core) for Jackson data processor
https://github.com/FasterXML/jackson
Apache License 2.0
1.03k stars 330 forks source link

Annotation for DeserializationConfig.Feature ACCEPT_SINGLE_VALUE_AS_ARRAY (via @JsonFormat(with=Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)) #43

Closed Polve closed 9 years ago

Polve commented 10 years ago

I would like to configure that property per-class, using annotations.

cowtowncoder commented 9 years ago

One possible way to implement this: add a new property or properties for @JsonFormat -- seems like it'd be the relevant existing annotation to use. I think this should also cover the related SerializationFeature.WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED as well.

cowtowncoder commented 9 years ago

Note: will be implemented as somewhat general-purpose facility, extension to @JsonFormat with new properties with and without, and enumeration JsonFormat.Feature that defines possible features to enable/disable. The reason latter is needed (instead of referring to SerializationFeature, DeserializationFeature) is that annotation package does not (and can not) depend on jackson-databind, so there will be bit of redundancy. On plus side this does allow carefully selecting kinds of features that can and should be supported, as well as possibly adding things for which there is no databind-level feature.

fabiolados commented 9 years ago

This was a nice addition. I encountered a possible problem: #67