Skip to content

Commit

Permalink
Display the right location when required property unassigned, related…
Browse files Browse the repository at this point in the history
… to issue #40
  • Loading branch information
philippemerle committed Mar 4, 2022
1 parent 9b63c52 commit 2b40f6b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
5 changes: 3 additions & 2 deletions bin/cloudnet/tosca/type_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from cloudnet.tosca.diagnostics import diagnostic
from cloudnet.tosca.processors import CEND, CRED, Checker
from cloudnet.tosca.utils import merge_dict, normalize_dict
from cloudnet.tosca.yaml_line_numbering import StrCoord, DictCoord
from cloudnet.tosca.yaml_line_numbering import Coord as YamlCoord

profiles_directory = "file:" + os.path.dirname(__file__) + "/profiles"

Expand Down Expand Up @@ -3630,7 +3630,8 @@ def check_required_fields(
+ " required "
+ kind
+ " unassigned",
definition,
definition if isinstance(definition, YamlCoord)
else self.reserved_function_keywords.get("SELF"),
)
else:
self.info(
Expand Down
20 changes: 20 additions & 0 deletions tests/issues/issue_40.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# https://github.com/Orange-OpenSource/Cloudnet-TOSCA-toolbox/issues/40
tosca_definitions_version: tosca_simple_yaml_1_3

capability_types:
CT:
properties:
p1:
type: integer

node_types:
NT:
capabilities:
c1:
type: CT

topology_template:
node_templates:
n1:
type: NT
# ERROR: p1 required property unassigned
3 changes: 2 additions & 1 deletion tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Software Name : Cloudnet TOSCA toolbox
# Version: 1.0
# SPDX-FileCopyrightText: Copyright (c) 2020-21 Orange
# SPDX-FileCopyrightText: Copyright (c) 2020-22 Orange
# SPDX-License-Identifier: Apache-2.0
#
# This software is distributed under the Apache License 2.0
Expand Down Expand Up @@ -67,6 +67,7 @@ check_regression topology_template_substitution_mapping.yaml

# Cloudnet TOSCA Toolbox issues
check_regression issues/issue_39.yaml
check_regression issues/issue_40.yaml
check_regression issues/issue_41.yaml
check_regression issues/issue_42.yaml
check_regression issues/issue_43.yaml
Expand Down

0 comments on commit 2b40f6b

Please sign in to comment.