-
Type: Bug
-
Status: Resolved
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 9.10, 10.10
-
Fix Version/s: 9.10-HF38, 10.10-HF18, 11.1, 2021.0
-
Component/s: Rest API
-
Release Notes Summary:REST API allows to set properties in a complex to null.
-
Tags:
-
Backlog priority:800
-
Team:PLATFORM
-
Sprint:nxplatform 11.1.19, nxplatform 11.1.20, nxplatform 11.1.21, nxplatform 11.1.22
-
Story Points:3
- in Studio create a custom document type customSchemaDoc with a custom schema containing a complex including 3 String properties
- generate forms in Designer for the document type
- install Nuxeo
- create a document of type customSchemaDoc
- set values for the 3 properties in the complex field (val1, val2, val3)
- through REST try to set the properties as null (see the mycustomschema:myComplexThing section):
curl -u Administrator:Administrator -X PUT \ http://localhost:8080/nuxeo/api/v1/id/d59d8b39-17bc-4caa-9602-0d5a7b667fd7 \ -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/json' \ -H 'X-NXproperties: *' \ -H 'uid: Administrator' \ -d '{ "entity-type": "document", "repository": "default", "uid": "d59d8b39-17bc-4caa-9602-0d5a7b667fd7", "path": "/default-domain/workspaces/testWorkspace23423/mytestdoccplx", "type": "customSchemaDoc", "state": "project", "properties": { "dc:description": "truc muche description", "mycustomschema:myComplexThing" : { "myAttrBla1" : null, "myAttrBla2" : null, "myAttrBla3" : null } } }'|json_pp
This does not work and displays the following:
{ "state" : "project", "facets" : [], "isCheckedOut" : true, "changeToken" : "20-0", "uid" : "d59d8b39-17bc-4caa-9602-0d5a7b667fd7", "title" : "mytestdoccplx", "properties" : { "dc:lastContributor" : "Administrator", "common:icon" : null, "uid:minor_version" : 0, "dc:modified" : "2018-07-02T13:32:50.124Z", "dc:nature" : null, "dc:title" : "mytestdoccplx", "uid:uid" : null, "dc:created" : "2018-07-02T12:58:54.027Z", "dc:issued" : null, "mycustomschema:myComplexThing" : { "myAttrBla1" : "val1", "myAttrBla3" : "val3", "myAttrBla2" : "val2" }, "dc:creator" : "Administrator", "dc:source" : null, "uid:major_version" : 0, "dc:format" : null, "dc:description" : "truc muche description", "common:icon-expanded" : null, "dc:publisher" : null, "dc:language" : null, "dc:contributors" : [ "Administrator" ], "dc:expired" : null, "dc:rights" : null, "dc:coverage" : null, "dc:subjects" : [], "dc:valid" : null }, "isProxy" : false, "repository" : "default", "entity-type" : "document", "isVersion" : false, "lastModified" : "2018-07-02T13:32:50.124Z", "parentRef" : "a1858390-ee7d-4b5d-bdd0-5971ea8a3714", "path" : "/default-domain/workspaces/testWorkspace23423/mytestdoccplx", "type" : "customSchemaDoc" }
- Now try the same with at least one value and the rest set to null:
curl -u Administrator:Administrator -X PUT \ http://localhost:8080/nuxeo/api/v1/id/d59d8b39-17bc-4caa-9602-0d5a7b667fd7 \ -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/json' \ -H 'X-NXproperties: *' \ -H 'uid: Administrator' \ -d '{ "entity-type": "document", "repository": "default", "uid": "d59d8b39-17bc-4caa-9602-0d5a7b667fd7", "path": "/default-domain/workspaces/testWorkspace23423/mytestdoccplx", "type": "customSchemaDoc", "state": "project", "properties": { "dc:description": "truc muche description", "mycustomschema:myComplexThing" : { "myAttrBla1" : "hop", "myAttrBla2" : null, "myAttrBla3" : null } } }'|json_pp
This works as expected:
{ "path" : "/default-domain/workspaces/testWorkspace23423/mytestdoccplx", "isVersion" : false, "repository" : "default", "type" : "customSchemaDoc", "title" : "mytestdoccplx", "state" : "project", "parentRef" : "a1858390-ee7d-4b5d-bdd0-5971ea8a3714", "changeToken" : "21-0", "isProxy" : false, "uid" : "d59d8b39-17bc-4caa-9602-0d5a7b667fd7", "isCheckedOut" : true, "properties" : { "dc:creator" : "Administrator", "dc:valid" : null, "common:icon" : null, "dc:title" : "mytestdoccplx", "uid:major_version" : 0, "dc:publisher" : null, "dc:description" : "truc muche description", "dc:coverage" : null, "common:icon-expanded" : null, "dc:expired" : null, "dc:source" : null, "uid:minor_version" : 0, "dc:lastContributor" : "Administrator", "dc:contributors" : [ "Administrator" ], "dc:modified" : "2018-07-02T13:34:02.324Z", "uid:uid" : null, "dc:issued" : null, "dc:created" : "2018-07-02T12:58:54.027Z", "dc:subjects" : [], "dc:format" : null, "dc:rights" : null, "mycustomschema:myComplexThing" : { "myAttrBla1" : "hop", "myAttrBla2" : null, "myAttrBla3" : null }, "dc:language" : null, "dc:nature" : null }, "lastModified" : "2018-07-02T13:34:02.324Z", "entity-type" : "document", "facets" : [] }
Expected behavior: all the values should be updated even if the new values are all null.
This issue happens with the WebUI.
Note: it seems one value must not be null to make this work.
Note 2: package is attached for faster reproduction.
- causes
-
NXP-28298 Fix nullifying a multi-valued property
- Resolved
-
NXP-28349 Fix DocumentModelJsonReader failing to read unknown property
- Resolved
- depends on
-
NXP-27978 Document resource endpoint does not handle null and empty array properties correctly
- Resolved
- is related to
-
NXP-28364 Clean up Web UI multi import property editing
- Resolved