Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Idea behind this solution
For referenced classes the idea is to preserve the links (version and service):
If we have a class that references to another service:
We would like that the metamodel reader conserves this attribute reference and that it builds it by pointing to the correct version/service. While at the same time change get the ownership of the attributes that are not linked.
So the my_class_type.go would look like:
The builders of foo will point to the
other_service/v1
and the builders of loo will point tomy_service/v1_alpha1
Previous approach
Previous approach #210 was relying on ownership to know the service and version of type. Whoever this caused a problem with link types and nested type. A type could be link in a class and be an attribute of another class. This causes a conflict on preservation of link and it depended on how the tree representation was created, as it was in that moment where the ownership was modified.
Current solution
This work adds a new field in the attribute type linkOwner, that will preserve the link ownership if exists. When it is a link of a referenced class this field will held the version of the attribute. So, it is used in the reader and the builders to generate the sdk.