Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#8362 closed defect (fixed)

dojox.json.ref.toJson doesn't serialize the key start with "_"

Reported by: denverdino Owned by: Kris Zyp
Priority: high Milestone: 1.3
Component: Dojox Version: 1.2.0
Keywords: Cc:
Blocked By: Blocking:

Description

When I use the CouchDBRestStore to save the update item as following, CouchDB server (0.8.1) return 412 error for the update conflict

E.g.

myStore.setValue(item, "content", editor.getValue()); myStore.save();

After I trace the problem, I figure out it is due to dojox.json.ref.toJson doesn't serialize the key start with "_". So the "_rev" field doesn't be serialized and sent to the CouchDB

Is this a defect or there are some work around for it?

Thanks

Change History (4)

comment:1 Changed 11 years ago by Adam Peller

Component: GeneralDojox
Owner: changed from anonymous to Kris Zyp
Summary: CouchDBRestStore save failed due to dojox.json.ref.toJson doesn't serialize the key start with "_"dojox.json.ref.toJson doesn't serialize the key start with "_"

dojox.json.ref.toJson({"_abc":1}) yields {}

comment:2 Changed 11 years ago by Adam Peller

hmm... line 293 of ref.js seems to make an explicit exception

			}else if(typeof i == "string" && i.charAt(0) != '_'){

should we just document this? If so, please reassign to dojox.data so we can rework CouchDB...

comment:3 Changed 11 years ago by Kris Zyp

Resolution: fixed
Status: newclosed

(In [16434]) Fixes #8337, validating new items when a dojox.json.schema is present Fixes #8362, allowing single underscore prefixed properties, but not double score prefixed properties ItemExplorer? catches error to alert the end user dojox.json.schema now has a mustBeValid that can throw an informative exception for the user dojox.rpc.JsonRest? updated to revert data properly when a HTTP request fails when saving changes

comment:4 Changed 11 years ago by Adam Peller

Milestone: tbd1.3

batch move of tickets marked 'tbd' fixed in the 1.3 timeframe

Note: See TracTickets for help on using tickets.