diff --git a/src/aosm/azext_aosm/build_processors/base_processor.py b/src/aosm/azext_aosm/build_processors/base_processor.py index 13e0031b33e..34dd9fc42ea 100644 --- a/src/aosm/azext_aosm/build_processors/base_processor.py +++ b/src/aosm/azext_aosm/build_processors/base_processor.py @@ -8,7 +8,7 @@ from typing import Any, Dict, List, Tuple from knack.log import get_logger - +from azure.cli.core.azclierror import InvalidArgumentValueError from azext_aosm.common.artifact import BaseArtifact from azext_aosm.common.constants import CGS_NAME from azext_aosm.definition_folder.builder.local_file_builder import LocalFileBuilder @@ -184,6 +184,21 @@ 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" or "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" + "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." + ) + else: + raise InvalidArgumentValueError( + f"The subschema {subschema_name} does not contain a type. This is a required field.\n" + "Please fix your values.schema.json or remove the schema and the CLI will generate a " + "generic schema." + ) # If the property is not in the values, and is required, add it to the values. if ( "required" in schema