Skip to content

The merge+patch implementation does not support merging arrays nested within a map #2350

Closed
@vkhoroshko

Description

@vkhoroshko

Assume an entity mapped like that (using hibernate-types-60 library for JsonType):

    @Type(JsonType.class)
    @Column(name = "additional_info")
    private Map<String, Object> additionalInfo;

When a first PATCH request is executed for the entity with the following request body:

PATCH /testEntities/1
{  
    "additionalInfo": {
        "testArray": ["val1"]       
    }   
}

Then, correct JSON is stored in a database.

However, on all subsequent PATCH requests it's simply impossible to update this nested array property. E.g. the following call:

PATCH /testEntities/1
{  
    "additionalInfo": {
        "testArray": ["val1", "val2", "val3"]       
    }   
}

does not make any effect.

The expected behavior is to have an ability to overwrite nested array fields. Currently the only possible way to accomplish that is to make 2 calls - 1st to set the array back to null (this works as DomainObjectReader does not even try to merge and simply replaces the value. And 2nd to set the array to the desired value.

Thanks in advance.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions