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
38 stars 25 forks source link

Requirement definition `count_range` implied default should be [ 0, UNBOUNDED ] #117

Closed tliron closed 1 year ago

tliron commented 2 years ago

In TOSCA 1.3 the occurrences keyname has an implied default of [ 1, 1 ]. We've carried this over in TOSCA 2.0 with the new name of count_range.

I don't think this is the right default. As it stands, it means that we believe that in most cases users intend a requirement to result in exactly one relationship. Moreover, it has an important side effect: if users do not assign any requirement at the node template then one will be assigned automatically for them. It means that if users simply write a requirement definition without paying attention to the counting keynames then node templates would all get a requirement assignment.

Automatic assignment is a very useful feature, which I fully support and proposed, but the question is whether it's what users intend if they don't specify the counting keynames. I've found that for the vast majority of my requirement definitions I have to explicitly set count_range to [ 0, UNBOUNDED ] or [ 0, 1 ] to avoid automatic assignment.

I think the reasonable default behavior for a requirement definition should be: assign it as many times as you want, and don't assign it if you don't want. Meaning: [ 0, UNBOUNDED ]. Automatic assignment should be an "opt in" feature. If a profile designer wants that to happen then they should set the lower bound of count_range to 1 or more.

tliron commented 2 years ago

This has been accepted by the ad hoc.

tliron commented 2 years ago

And implemented in Puccini.

lauwers commented 1 year ago

This has been documented in https://docs.oasis-open.org/tosca/TOSCA/v2.0/csd05/TOSCA-v2.0-csd05.html#_Toc125468587