buffet: Provide results definition in command definition.
That allows us to provide typed results for supported commands.
BUG=chromium:435607
TEST=cros_workon_make --test buffet
Change-Id: I61b5a5b294b4d869366c821adf1ef7f6db31c7ea
Reviewed-on: https://chromium-review.googlesource.com/231322
Reviewed-by: Anton Muhin <antonm@chromium.org>
Commit-Queue: Anton Muhin <antonm@chromium.org>
Tested-by: Anton Muhin <antonm@chromium.org>
diff --git a/buffet/commands/command_dictionary.h b/buffet/commands/command_dictionary.h
index bd60986..c316fd5 100644
--- a/buffet/commands/command_dictionary.h
+++ b/buffet/commands/command_dictionary.h
@@ -21,6 +21,7 @@
namespace buffet {
class CommandDefinition;
+class ObjectSchema;
// CommandDictionary is a wrapper around a map of command name and the
// corresponding command definition schema. The command name (the key in
@@ -71,6 +72,13 @@
const CommandDefinition* FindCommand(const std::string& command_name) const;
private:
+ std::shared_ptr<ObjectSchema> BuildObjectSchema(
+ const base::DictionaryValue* command_def_json,
+ const char* property_name,
+ const ObjectSchema* base_def,
+ const std::string& command_name,
+ chromeos::ErrorPtr* error);
+
using CommandMap = std::map<std::string,
std::shared_ptr<const CommandDefinition>>;