Open milesstoetzner opened 2 months ago
The tosca parser puts them all in one namespace and it isn't an error to reassign, though it should probably be a warning at least. If you think of tosca as a programing language, most languages declaring name binding in one scope will just shadow or override the same name declared in another scope. I think that's the reasoning at least... Regardless, changing this would be a breaking change, but I'll keep this issue open to at least warn, or maybe there could be a strict mode that you could opt-in to, maybe via metadata on the service template.
Thanks for the insights.
though it should probably be a warning at least
A warning would be great.
but I'll keep this issue open to at least warn
I am also fine with closing this issue as long as you do not intend to implement anything regarding this issue, e.g., the warning. A closed issue can still be found via the search.
Are type names unique per type collection (node types, artifact types, interface types, etc.) or per service template?
I am currently developing my own normative types. Thereby, I also define some root types for each type collection and call them all
root
. I assumed that even though these types have the same name, they are distinct since they are from different collections. However, this does not seem to be the case in Unfurl.I did not find anything regarding the uniqueness of type names in the TOSCA spec.
Nevertheless, the current behaviour of Unfurl seems odd to me. There should be at least an error when two types have the same name (and not overridden?).
Here is a simple example.
Validation will fail as follows since due to some reason
interface_types.root
is treated asartifact_types.root
and, hence, throws the validation error mentioned in https://github.com/onecommons/unfurl/issues/340.Having unique names solves this issue.
I tried this on Unfurl v1.0.0 and v1.1.0.
Best regards Miles