Closed honstar closed 11 years ago
The example you showed is not syntactically correct, I think you meant
{
"list": ["value1", "value2"],
"jcr:primaryType": "nt:unstructured"
}
If this is the case, my previous commit solves the problem.
Yes exactly, sorry for the bad example.
Forgot to mention that this works now perfectly. Thanks.
One minor thing to mention though: in case a multi-value property only contains a single item, the resulting property in the repository is not marked as such. This is due to the fact that only a single parameter will be present in the request, thus the Sling POST Servlet cannot know about its multi-value nature.
To enforce this, the
From a Sling resource API point of view, I think this does not have any functional impact. In case a single-value property is fetched via the ValueMap#get method as array, it returns a single-item array.
You can include @TypeHint parameters inside the .json
descriptor files. Each key in the descriptor will be posted as a form parameter.
In example:
{
"list": ["value1"],
"list@TypeHint": "String[]",
"jcr:primaryType": "nt:unstructured"
}
True, that would work. I forgot that the JSON data basically represents the request parameters for the Sling POST Servlet instead of the real content serialized by the Sling DefaultGetServlet.
Currently, it is not possible to create nodes having multi-value properties.
Consider following json data:
{ "list": [ "item1": "value1", "item2": "value2" ], "jcr:primaryType": "nt:unstructured" }
A fatal error is thrown: "Fatal error: Arrays are not supported."