Closed arkadiusz-wieczorek closed 8 years ago
Please include here the declaration of your resource-types and the full stack from the console
Ok, I will add this information.
new Sealious.ChipTypes.ResourceType({
name: "person",
human_readable_name: "Person",
human_readable_description: "Description about ResourceType: Person",
fields: [
{name: "name", type: "text"},
{name: "age", type: "int"},
{name: "lat", type: "float", required: true}
]
//,
// access_strategy: {
// } //crud
});
01:52:58.110 - error: PATCH /api/v1/person/ude30cvhhm
from: 127.0.0.1, mime: multipart/form-data
result: failed - There are problems with some of the provided values.
Error: There are problems with some of the provided values.
at new SealiousErrors.Error (/home/arkadiusz/Projects/hello-world/node_modules/sealious/lib/response/error.js:6:12)
at new SealiousErrors.ValidationError (/home/arkadiusz/Projects/hello-world/node_modules/sealious/lib/response/error.js:21:12)
at /home/arkadiusz/Projects/hello-world/node_modules/sealious/lib/chip-types/resource-type.js:171:28
at bound (domain.js:250:14)
at runBound (domain.js:263:12)
at tryCatcher (/home/arkadiusz/Projects/hello-world/node_modules/sealious/node_modules/bluebird/js/main/util.js:26:23)
at Promise._settlePromiseFromHandler (/home/arkadiusz/Projects/hello-world/node_modules/sealious/node_modules/bluebird/js/main/promise.js:503:31)
at Promise._settlePromiseAt (/home/arkadiusz/Projects/hello-world/node_modules/sealious/node_modules/bluebird/js/main/promise.js:577:18)
at Promise._settlePromises (/home/arkadiusz/Projects/hello-world/node_modules/sealious/node_modules/bluebird/js/main/promise.js:693:14)
at Async._drainQueue (/home/arkadiusz/Projects/hello-world/node_modules/sealious/node_modules/bluebird/js/main/async.js:123:16)
at Async._drainQueues (/home/arkadiusz/Projects/hello-world/node_modules/sealious/node_modules/bluebird/js/main/async.js:133:10)
at Immediate.Async.drainQueues [as _onImmediate] (/home/arkadiusz/Projects/hello-world/node_modules/sealious/node_modules/bluebird/js/main/async.js:15:14)
at processImmediate [as _immediateCallback] (timers.js:371:17)
{
"id": "ude30cvhhm",
"type": "person",
"body": {
"name": "2",
"age": 2,
"lat": 2.4
},
"created_context": {
"timestamp": 1445557957742,
"ip": "127.0.0.1",
"user_id": "neglxy1mn1"
}
}
^^^
ude30cvhhm
(without "lat" field) <- it generated error.It's the change in our new api, because on sealious@0.4.9 in Placetag I sent PATCH without latitude and longitude fields for update place and it worked. At now I had to add latitude and longitude fields for success update.
I've written test cases that reproduce your issue and fixed it. Changes are now live on 0.6.16. Please check if the issue is fixed and reopen this issue if necessary.
When I sent PATCH for some resource without fields with property
required: "true"
I've received error:Because I didn't give values of fields
latitude
andlongitude
with propertyrequired: "true"
.In my opinion such fields shouldn't be checked until validation. What do you think?