File tree Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ struct
182182 begin
183183 try get_value (List. assoc key m) pth
184184 with Not_found ->
185- try get_value (List. assoc Options. defaults_additional_field m) pth
185+ try get_value (List. assoc Options. defaults_additional_field m) pth (* if schema specifies additionalProperties, then use the default from that *)
186186 with Not_found -> raise ConfTypeError
187187 end
188188 | `List a , Index (Int i , pth ) ->
@@ -227,7 +227,8 @@ struct
227227 match o, pth with
228228 | `Assoc m , Select (key ,pth ) ->
229229 let rec modify = function
230- | [] -> [(key, create_new v pth)]
230+ | [] ->
231+ [(key, create_new v pth)] (* create new key, validated by schema *)
231232 | (key' , v' ) :: kvs when key' = key ->
232233 (key, set_value v v' pth) :: kvs
233234 | (key' , v' ) :: kvs ->
Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ let rec element_defaults ?additional_field (element: element): Yojson.Safe.t =
9595 | Object object_specs ->
9696 let additional = match additional_field, object_specs.additional_properties with
9797 | Some additional_field , Some additional_properties ->
98+ (* create additional field with the additionalProperties default value for lookup in GobConfig *)
9899 [(additional_field, element_defaults ~additional_field additional_properties)]
99100 | _ , _ ->
100101 []
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ let schema =
2828
2929let require_all = JsonSchema. schema_require_all schema
3030
31- let defaults_additional_field = " __additional__"
31+ let defaults_additional_field = " __additional__" (* tihs shouldn't conflict with any actual field *)
3232let defaults = JsonSchema. schema_defaults ~additional_field: defaults_additional_field schema
3333
3434let () =
You can’t perform that action at this time.
0 commit comments