Open philippemerle opened 2 years ago
Hi, @philippemerle thanks for opening this, I see that we should probably use ParameterDefinition
instead of PropertyDefinition
in src/opera/parser/tosca/v_1_3/capability_type.py
(and also in other places where appropriate).
Still opera
's TOSCA parser would expect a map (= dict) and to me refinement with just property_name: value
(like id: TMF632
or name: party
in your example) feels weird but if this is the correct syntax we would need to add additional possibility (XOR between map and direct value).
If I use ParameterDefinition
in src/opera/parser/tosca/v_1_3/capability_type.py
and change template to use a map type for property it goes through xOpera validation just fine:
tosca_definitions_version: tosca_simple_yaml_1_3
capability_types:
TMFAPI:
derived_from: tosca.capabilities.Node
description: a TMForum defined REST API
properties:
id:
type: string
description: the id e.g TMF632
name:
type: string
description: the name, e.g. party
TMF632:
derived_from: TMFAPI
properties:
id:
value: TMF632
name:
value: party
According to Section 3.6.14.2 of TOSCA 1.3, the <parameter_name>: <parameter_value> | { <parameter_value_expression> }
shall be supported. So you would need to add additional possibilities, i.e. map and direct value and value expression such as get_property.
Given the following template
then
According to both Section 3.6.10.6 and the last example of Section 3.6.10.8 of TOSCA v1.3, both lines 18 and 19 are correct.
Thank to @pmjordan for reporting this problem.