From fbd2b22c71eefbae1f74ea5028fc61b586306c43 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 3 Nov 2017 17:24:53 +0000 Subject: [PATCH] Inherit 'required' correctly --- templating/matrix_templates/units.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/templating/matrix_templates/units.py b/templating/matrix_templates/units.py index e7d73e3f..dfcb6c82 100644 --- a/templating/matrix_templates/units.py +++ b/templating/matrix_templates/units.py @@ -143,10 +143,16 @@ def inherit_parents(obj): # iterate through the parents first, and then overwrite with the settings # from the child. for p in map(inherit_parents, parents) + [obj]: - for key in ('type', 'title', 'required', 'description'): + # child blats out type, title and description + for key in ('type', 'title', 'description'): if p.get(key): result[key] = p[key] + # other fields get merged + for key in ('required', ): + if p.get(key): + result.setdefault(key, []).extend(p[key]) + for key in ('properties', 'additionalProperties', 'patternProperties'): if p.get(key): result.setdefault(key, OrderedDict()).update(p[key])