buffet: Cleanup GCD command definition type system.

Moved a lot of duplicated code for different parameter types
into base classes. Split ParamType::FromJson into three separate
function (FromJson, ObjectSchemaFromJson, ConstraintsFromJson)
which allows more fine-grained control of deserializing various
pieces of schema amongst the members of type class hierarchy.
This way, "enum" constraint (applicable to all types) can be
handled in a base class while concrete type-specific properties
will be read in respective top-level classes.

Added error checking for invalid/unexpected object schema
properties when parsing type definition. This allows correct
reporting of unrecognized properties, as well as nice errors
when incompatible properties are specified (e.g. both "enum" and
"min/max" constraints at the same time).

BUG=chromium:374860
TEST=All unit tests pass.

Change-Id: I18b94338680b9b859ba964fd63b65273ca2521f6
Reviewed-on: https://chromium-review.googlesource.com/204971
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
4 files changed
tree: 368d6ef41f88ea13fab09441370abde1b0ac7758
  1. buffet/