buffet: Add Array type support for Buffet command and state props

Added definition of ArrayPropType and ArrayPropValue, added
parsing code to ObjectSchema to parse the array object type as well
as type detection code to detect array types from 'items', 'enum',
'default' properties of object schema definition.

Added a bunch of unit tests to verify that array definitions can
be parsed, values of type arrays can be constructuted and value
validation code works with arrays.

BUG=brillo:107
TEST=`FEATURES=test emerge-link buffet`

Change-Id: I0f7bbed012792e0a49fa1b071bb56fee512825a9
Reviewed-on: https://chromium-review.googlesource.com/261616
Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Trybot-Ready: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/commands/prop_constraints.cc b/buffet/commands/prop_constraints.cc
index 085fe26..f773290 100644
--- a/buffet/commands/prop_constraints.cc
+++ b/buffet/commands/prop_constraints.cc
@@ -160,9 +160,9 @@
 }
 
 // ConstraintOneOf --------------------------------------------------
-ConstraintOneOf::ConstraintOneOf(InheritableAttribute<ChoiceList> set)
+ConstraintOneOf::ConstraintOneOf(InheritableAttribute<native_types::Array> set)
     : set_(std::move(set)) {}
-ConstraintOneOf::ConstraintOneOf(ChoiceList set)
+ConstraintOneOf::ConstraintOneOf(native_types::Array set)
     : set_(std::move(set)) {}
 
 bool ConstraintOneOf::Validate(const PropValue& value,
@@ -180,7 +180,7 @@
 }
 
 std::unique_ptr<Constraint> ConstraintOneOf::Clone() const {
-  InheritableAttribute<ChoiceList> attr;
+  InheritableAttribute<native_types::Array> attr;
   attr.is_inherited = set_.is_inherited;
   attr.value.reserve(set_.value.size());
   for (const auto& prop_value : set_.value) {
@@ -190,7 +190,7 @@
 }
 
 std::unique_ptr<Constraint> ConstraintOneOf::CloneAsInherited() const {
-  ChoiceList cloned;
+  native_types::Array cloned;
   cloned.reserve(set_.value.size());
   for (const auto& prop_value : set_.value) {
     cloned.push_back(prop_value->Clone());
@@ -200,14 +200,7 @@
 
 std::unique_ptr<base::Value> ConstraintOneOf::ToJson(
     chromeos::ErrorPtr* error) const {
-  std::unique_ptr<base::ListValue> list(new base::ListValue);
-  for (const auto& prop_value : set_.value) {
-    auto json = prop_value->ToJson(error);
-    if (!json)
-      return std::unique_ptr<base::Value>();
-    list->Append(json.release());
-  }
-  return std::move(list);
+  return TypedValueToJson(set_.value, error);
 }
 
 const char* ConstraintOneOf::GetDictKey() const {