From 638f1ba1fb1bb11e44dd443a7345cc3383ecc0dd Mon Sep 17 00:00:00 2001 From: Jordan Date: Fri, 15 Mar 2024 17:23:47 +0000 Subject: [PATCH 1/3] check for dict before checking type --- .../azext_aosm/build_processors/base_processor.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/aosm/azext_aosm/build_processors/base_processor.py b/src/aosm/azext_aosm/build_processors/base_processor.py index 82de0a04a8e..ac24022981f 100644 --- a/src/aosm/azext_aosm/build_processors/base_processor.py +++ b/src/aosm/azext_aosm/build_processors/base_processor.py @@ -185,11 +185,18 @@ def generate_values_mappings( # Loop through each property in the schema. for subschema_name, subschema in schema["properties"].items(): - if "type" not in subschema: - if ["oneOf", "anyOf"] in subschema: + if isinstance(subschema, dict) and "type" not in subschema: + if "oneOf" in subschema: raise InvalidArgumentValueError( f"The subschema '{subschema_name}' does not contain a type.\n" - "It contains 'anyOf' or 'oneOf' logic, which is not valid for AOSM.\n" + "It contains 'oneOf' logic, which is not valid for AOSM.\n" + "Please remove this from your values.schema.json and provide a concrete type " + "or remove the schema and the CLI will generate a generic schema." + ) + if "anyOf" in subschema: + raise InvalidArgumentValueError( + f"The subschema '{subschema_name}' does not contain a type.\n" + "It contains 'anyOf' logic, which is not valid for AOSM.\n" "Please remove this from your values.schema.json and provide a concrete type " "or remove the schema and the CLI will generate a generic schema." ) From 25ee61d57a62e1781ccc46bb7e9eda0262d33734 Mon Sep 17 00:00:00 2001 From: Cyclam <95434717+Cyclam@users.noreply.github.com> Date: Sat, 16 Mar 2024 07:30:03 +0000 Subject: [PATCH 2/3] Update src/aosm/azext_aosm/build_processors/base_processor.py --- src/aosm/azext_aosm/build_processors/base_processor.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/aosm/azext_aosm/build_processors/base_processor.py b/src/aosm/azext_aosm/build_processors/base_processor.py index ac24022981f..cc1b6649df6 100644 --- a/src/aosm/azext_aosm/build_processors/base_processor.py +++ b/src/aosm/azext_aosm/build_processors/base_processor.py @@ -189,14 +189,7 @@ def generate_values_mappings( if "oneOf" in subschema: raise InvalidArgumentValueError( f"The subschema '{subschema_name}' does not contain a type.\n" - "It contains 'oneOf' logic, which is not valid for AOSM.\n" - "Please remove this from your values.schema.json and provide a concrete type " - "or remove the schema and the CLI will generate a generic schema." - ) - if "anyOf" in subschema: - raise InvalidArgumentValueError( - f"The subschema '{subschema_name}' does not contain a type.\n" - "It contains 'anyOf' logic, which is not valid for AOSM.\n" + "It contains 'anyOf' or 'oneOf' logic, which is not valid for AOSM.\n" "Please remove this from your values.schema.json and provide a concrete type " "or remove the schema and the CLI will generate a generic schema." ) From 5691fe975d2ca4cdb7b809315f4c11aac9f95857 Mon Sep 17 00:00:00 2001 From: Andy Churchard Date: Tue, 19 Mar 2024 16:03:59 +0000 Subject: [PATCH 3/3] Revert oneOf/anyOf split processing. --- src/aosm/azext_aosm/build_processors/base_processor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aosm/azext_aosm/build_processors/base_processor.py b/src/aosm/azext_aosm/build_processors/base_processor.py index cc1b6649df6..a3495de7d41 100644 --- a/src/aosm/azext_aosm/build_processors/base_processor.py +++ b/src/aosm/azext_aosm/build_processors/base_processor.py @@ -186,7 +186,7 @@ def generate_values_mappings( for subschema_name, subschema in schema["properties"].items(): if isinstance(subschema, dict) and "type" not in subschema: - if "oneOf" in subschema: + if ["oneOf", "anyOf"] in subschema: raise InvalidArgumentValueError( f"The subschema '{subschema_name}' does not contain a type.\n" "It contains 'anyOf' or 'oneOf' logic, which is not valid for AOSM.\n"