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

[feature] self-identifying parameters in map forms #3

Open
mathieucaroff opened this issue Jul 9, 2020 · 1 comment
Open

[feature] self-identifying parameters in map forms #3

mathieucaroff opened this issue Jul 9, 2020 · 1 comment

Comments

@mathieucaroff
Copy link
Contributor

The OSASIS Tosca lidy schema has the following type:

topology_template::TTopologyTemplate:
  _mapFacultative:
    description: description
    inputs: input_parameters
    outputs: output_parameters
    node_templates: node_templates
    relationship_templates: relationship_templates
    groups: group_defs
    policies: policy_defs
    substitution_mappings: substitution_mappings
    workflows: imperative_workflow_defs

There are a few repetitions of identifiers between keys and values: description: description. Since _* are reserved by lidy, we could use _ as a special value to indicate that the value of the entry should be checked by the rule whose name corresponds to the key. This would allow to write the above schema as follows:

topology_template::TTopologyTemplate:
  _mapFacultative:
    description: _
    inputs: input_parameters
    outputs: output_parameters
    node_templates: _
    relationship_templates: relationship_templates
    groups: group_defs
    policies: policy_defs
    substitution_mappings: _
    workflows: imperative_workflow_defs

@treivax Does it look good to you?

@mathieucaroff
Copy link
Contributor Author

mathieucaroff commented Jul 9, 2020

I just came across a similar use case: namespaced self-identifying parameters.

I believe that namespaced self-identifying parameters will be the more common use case of the two, so the syntax for SIP (self-identifying parameters) should take it into account. Using NSIP (namespaced-self-identifying parameters) helps to refactor with confidence.

Example:

value_expression::TValueExpression:
  _max: 1
  _mapFacultative:
    concat:               value_expression.concat
    get_input:            value_expression.get_input
    get_nodes_of_type:    value_expression.get_nodes_of_type
    token:                value_expression.token
    join:                 value_expression.join
    get_property:         value_expression.get_property
    get_attribute:        value_expression.get_attribute
    get_operation_output: value_expression.get_operation_output
    get_artifact:         value_expression.get_artifact

The above lidy rule would then become:

value_expression::TValueExpression:
  _max: 1
  _mapFacultative:
    concat: _
    get_input: _
    get_nodes_of_type: _
    token: _
    join: _
    get_property: _
    get_attribute: _
    get_operation_output: _
    get_artifact: _

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant