I've been playing around with modeshape, mostly hitting the rest API. I've discovered two problems with the results which i get from the rest API. In both cases, i'm making an ajax request (via jquery if its relevant) and accepting json.
First case (custom properties of objects):
consider a node which have the following custom properties:
If i GET this node, the json which is returned to me is something like the following:
the first property is what i would expect but not the second one. For the second, i'd expect the json to treat property two value as an object, not a string value ie
this isn't that big of a deal as i can cleanup the code on the client side. it's fairly predictable. I looked into the modeshape source for a bit but the error seems like it may perhaps be with the json library which modeshape uses.
Second case (query over property which is array):
Consider that I have a node with a property as follows:
If i invoke a GET on the rest API, i will get the expected JSON. However, if i return this column as a part of a query, I only get the first value. say i select the query as so:
The resulting row will have the following json:
as you can see, it does not return an array but rather a string value with the first element in the array. Digging into the code, RestQueryHandler.createRestRow gets the values for individual rows. it eventually calls .getString on the value which in fact returns just a string of the first element and not a string of the full array or anything else.
The first issue is only slightly annoying. The second is actually problematic as I can't use the query functionality to retrieve node properties which are arrays. If i need these values, i'm forced to execute the query to get the relevant nodes and then perform an actual GET on each one.