francescomari / grunt-sling-content

Deploy local content to a Sling instance
MIT License
6 stars 4 forks source link

Ensure multi-value field even with one array value #7

Closed bpauli closed 11 years ago

bpauli commented 11 years ago

When a value is an array the type of the property should always be an array. even when only one element is in the array.

francescomari commented 11 years ago

In this case, you can always use the TypeHint as a property in the .json file. You don't have to force it in the task itself.

bpauli commented 11 years ago

I agree that this hardcoded TypeHint is suboptimal.

But currently

{
  "categories": ["jquery"]
}

and

{
  "categories": "jquery"
}

produce the same property in the JCR and this is IMO wrong. An array should be always a multi-value field. So I guess the hardcoded TypeHit will be the lesser of the two evils

francescomari commented 11 years ago

My latest commit should fix this problem. Unless the user specifies a TypeHint inside the .json file, the task automatically adds one with value String[].

bpauli commented 11 years ago

Great, Thank you!

francescomari commented 11 years ago

I close the issue.