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

Define the behavior of `profile` and `namespace` keynames in imported files #120

Closed tliron closed 2 years ago

tliron commented 2 years ago

Currently we don't have clarity on this topic. See discussions on this PR.

The current thought is that we should think of them "programmatically", by which I mean define the parser's behavior when it encounters them. The semantics would then follow. Specifically, this:

  1. If the parser encounters the keyname in a file it will be applied to all types in that file and also to imported files.
  2. If one of those imported files also has the keyname, then it would override or nest the value from that point in the import tree onward, recursively.

The result is a kind of "reverse inheritance" by which a file "inherits" the name from the file that imported it.

lauwers commented 2 years ago

This sounds like the correct interpretation to me. We should add that "best practice" is to only define the profile name in the top-level TOSCA file and not repeat it in the imported files (although repeating the profile name should not result in an error)

lauwers commented 2 years ago

This behavior is documented in Section 5.2.2.2 of Rev 3 of WD5