From 777b5d763228421cbb4564385d65766857d1829e Mon Sep 17 00:00:00 2001 From: Zach Baylin Date: Fri, 1 Apr 2022 16:56:09 -0500 Subject: [PATCH] Aws_gen: add support for additionalValues --- src/aws_gen.ml | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/aws_gen.ml b/src/aws_gen.ml index 8333b322b..d0ebdcba7 100644 --- a/src/aws_gen.ml +++ b/src/aws_gen.ml @@ -102,17 +102,26 @@ module Json = struct let open Yojson.Basic.Util in let original = to_assoc original in let overrides = to_assoc overrides in - `Assoc - (List.map - (fun (key, val_) -> - if key = "shapes" - then - let types = - try to_assoc (List.assoc "typeOverrides" overrides) with _ -> [] - in - key, `Assoc (override_shapes (to_assoc val_) types) - else key, val_) - original) + let overriden = + `Assoc + (List.map + (fun (key, val_) -> + if key = "shapes" + then + let types = + try to_assoc (List.assoc "typeOverrides" overrides) with _ -> [] + in + key, `Assoc (override_shapes (to_assoc val_) types) + else key, val_) + original) + in + let overriden = + let additional_values = + `Assoc (try to_assoc (List.assoc "additionalValues" overrides) with _ -> []) + in + merge overriden additional_values + in + overriden end let log s = Printf.eprintf (s ^^ "\n%!")