changeset 40:2376224a9717

FIX: when processing schema references and the resolved schema contains conditionals they must be evaluated
author Franz Glasner <f.glasner@feldmann-mg.com>
date Wed, 19 Jul 2023 15:19:23 +0200
parents 78f5ef0ee087
children d2b43423fa4c
files data_schema/__init__.py
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/data_schema/__init__.py	Wed Jul 19 14:19:21 2023 +0200
+++ b/data_schema/__init__.py	Wed Jul 19 15:19:23 2023 +0200
@@ -1155,6 +1155,13 @@
 
 
 def process_schema_references(schema, context, check_single_ref_key=True):
+    """
+
+    .. note:: If a new dereferenced schema is found schema conditionals are
+              evaluated also. So the resolved schema containing conditionals
+              behaves according to the given conditions.
+
+    """
     try:
         ref = schema[SCHEMA_REF_KEY]
     except (KeyError, TypeError):
@@ -1167,6 +1174,8 @@
         raise SchemaError(
             "dereferenced schema is not a `_Schema': {}".format(ref))
     schema = copy.deepcopy(schema)
+    # process schema conditionals "cond" and "match" again
+    schema = process_schema_conditionals(schema, context)
     return process_schema_references(schema, context, check_single_ref_key=True)