Skip to content

Commit

Permalink
Bug: No type in schema (#148)
Browse files Browse the repository at this point in the history
* first fix for anyOf logic error msg

* Update src/aosm/azext_aosm/build_processors/base_processor.py

Co-authored-by: Cyclam <95434717+Cyclam@users.noreply.github.com>

* Update src/aosm/azext_aosm/build_processors/base_processor.py

Co-authored-by: Cyclam <95434717+Cyclam@users.noreply.github.com>

---------

Co-authored-by: Jordan <jordan.layton@metaswitch.com>
Co-authored-by: Cyclam <95434717+Cyclam@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 26, 2024
1 parent b3d9f54 commit b6c781b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/aosm/azext_aosm/build_processors/base_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b6c781b

Please sign in to comment.