oasis-open / tosca-community-contributions

OASIS TC Open Repository: Manages TOSCA profiles, tests, and templates that are maintained by the TOSCA community. They are intended to be used as examples to help developers get started with TOSCA and to test compliance of TOSCA implementations with the standard.
https://github.com/oasis-open/tosca-community-contributions
Apache License 2.0
39 stars 25 forks source link

Tosca 1.3 override requirements in node_type #138

Open DYDKA4 opened 1 year ago

DYDKA4 commented 1 year ago

Why are requirements is list? So I can't override requirements via derived from mechanism. Can you explain why requirements is list? I think, that requirements should be dict and capability, node, relationship could be list.

tliron commented 1 year ago

This is a good question and we've debated it quite a lot. I think it was decided in order to keep the requirement definitions in the same syntactical structure as the requirement assignments. However, grammatically they are quite different. In the node type it's a "sequenced list" meaning that a name can only appear once. So it's essentially equivalent to a map, and you can override it this way. But in a node template the same requirement name can appear more than once, because we are assigning individual requirements.

I am in favor of changing requirement definitions in node types to be a map.

lauwers commented 1 year ago

As a rule of thumb, TOSCA uses lists whenever the order matters, which is definitely the case for requirements. A type designer may require that an orchestrator fulfill requirements in a specific order, e.g. when a node filter for requirement A uses a property value of a target node selected for requirement B. In that case, requirement B must be fulfilled before requirement A can be fulfilled. By organizing requirement definitions in a list, this ordering can be guaranteed.