Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property refinement not supported #246

Open
philippemerle opened this issue Feb 5, 2022 · 2 comments
Open

Property refinement not supported #246

philippemerle opened this issue Feb 5, 2022 · 2 comments
Labels
bug Something isn't working TOSCA Something that considers TOSCA standard

Comments

@philippemerle
Copy link
Contributor

Given the following template

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: TMF632
      name: party

then

$ opera validate template.yaml 
Validating service template...
template.yaml:19:11: [PropertyDefinition] Expected map.
$

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.

@anzoman
Copy link
Contributor

anzoman commented Feb 9, 2022

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

@anzoman anzoman added bug Something isn't working TOSCA Something that considers TOSCA standard labels Feb 9, 2022
@philippemerle
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working TOSCA Something that considers TOSCA standard
Projects
None yet
Development

No branches or pull requests

2 participants