Closed arkadiusz-wieczorek closed 6 years ago
It would be working otherwise after update https://github.com/Sealious/sealious/commit/bb165d234f8052238f76644ae0ce2e5a965f07b2
This bug still existing. I've noticed that after operation field which is type int - field has null
value.
From other resource type
{
"id": "4wb6lxbspm",
"type": "person",
"body": {
"name": {},
"age": null,
"lat": 98765432
},
"created_context": {
"timestamp": 1447164292844,
"ip": "127.0.0.1",
"user_id": false
},
"last_modified_context": {
"timestamp": 1447164329278,
"ip": "127.0.0.1",
"user_id": false
}
}
I've discovered quick fix on this bug, but it behaves as PATCH
method because we are using patch_resource
function in update_resource
. We should rewrite Sealious.Dispatcher.datastore.update
function to compatibility with any datastore driver. This function should have two cases supported by some parameter:
PATCH
→ standard updatePUT
→ remove old body, type new body, updateam I right?
this.update_resource = function(context, type_name, resource_id, body){
return Promise.try(function(){
var type = Sealious.ChipManager.get_chip("resource_type", type_name);
for (var i in type.fields) {
var field = type.fields[i];
if (!body.hasOwnProperty(field.name)) {
// body[field.name] = undefined;
delete body[field.name];
}
}
return self.patch_resource(context, type_name, resource_id, body, true);
})
}
It turned out it was an issue with www-server's way of preprocessing output. I've fixed that. You should ensure that your application uses the latest stable branch of www-server (v0.6.5
). Changes will take full effect once https://github.com/Sealious/sealious/pull/262 is merged and a new patch version of Sealious' stable branch is released.
Is this issue solved?
From what I know it still generates this issue.
Issues moved do Sealcode's phabricator: https://hub.sealcode.org/project/view/11/
I've sent POST method with minimal body for create new resource (latitude=2 & longitude=3)
After creating new resource I've sent PUT method also with minimal body (latitude=2 & longitude=4) to the above resource. As you can see this resource have unnecessary fields which are empty objects.
Structure resource