Fix deserialization of embedded values in HAL objects (#1630)

The embedded avatar object of the repository avatar plugin
leads to an exception without this configuration, when
a repository json object is deserialized. This happens
for example when the description of a repository should
be modified.
This commit is contained in:
René Pfeuffer
2021-04-26 08:11:13 +02:00
committed by GitHub
parent 26c04a2f8b
commit 6cd8fc5ba4
3 changed files with 13 additions and 2 deletions

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.api.rest;
import com.fasterxml.jackson.databind.AnnotationIntrospector;
@@ -50,6 +50,7 @@ public class ObjectMapperProvider implements Provider<ObjectMapper> {
mapper.setAnnotationIntrospector(createAnnotationIntrospector());
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
mapper.configure(SerializationFeature.WRITE_DATES_WITH_ZONE_ID, true);
mapper.setDateFormat(new StdDateFormat());
return mapper;