This repository has been archived by the owner on Feb 17, 2024. It is now read-only.
Add the capability to restrict properties on inherited object types via new proposed facet heritable #590
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.
Even when an entity should be always the same, we do not always use it entirety in all use cases. A typical case of what I try to explain is the difference between the input and output of any endpoint with a POST method. For these, typically the "id" attribute of the entity is not provided at the POST input, but is usually returned at the output. For both, the entity should be the same, however it would be good to denote that the input for that POST call is forbidden to enter the "id". If we would like to use the same entity (with no duplication), how could we make an exception for the "id" attribute in the case of the input in a POST call?
My proposal is as follows: Adding some modifier that allows to "subtract", "restrict", "omit" or "not consider as an existing or valid" those attributes that belongs to the parent entity and not directly to the child. In other words, considerer that not all attributes of the parent are automatically inherited to the children. Thus, it is possible to define a child for the input of the "POST", and another for the output, but both inheriting from the same base entity, something like this:
entity.raml
entity-child.raml
The problem here is that, right now, by inheriting both the same base entity, all attributes of the parent entity are inherited to "entity.post.in" and "entity.post.out" children. Regardless of the fact that "entity.post.in" does not define the "entityId" attribute, it is absolutely valid because it is declared by the parent.
In order to reach the behavior mentioned above, I propose to add the facet "heritable" at "Object Type Declarations" level with the following meaning:
Use Case:
Examples: