You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.
Each type has a lot of facets, e.g. displayName and others. What should happen if we create derived type? Should we inherit only fields, that affect validation result?
I mean should derived type inherit required and default options? In which order?
I used workbench, that uses raml-js-parser2 under the hood and i see that required and default fields are not inherited (as all other facets like example, examples, displayName, etc.).
If that is desired behaviour, that should be explicitly declared in the spec.
But from my point this is not valid behaviour.
I would have to define that UserEmail is required explicitly. Perhaps that is really ok, but that should be clarified in the spec then.
For Union that is quite obvious for me - just validate each type, if any is valid - Union is valid. But multiple inheritance raises a lot of questions.
The text was updated successfully, but these errors were encountered:
alvassin
changed the title
Definition is not clear for multiple inheritance
Plese clarify how multiple inheritance should work
Aug 24, 2018
Also, what about patterns in strings? If i derive from two parents, where each has pattern - i should
raise an exception?
Spec does not cover that case (only when parent and derived class have pattern definition):
If a sub-type inherits properties having the same name from at least two of its parent types, the sub-type keeps all restrictions applied to those properties with two exceptions: 1) a "pattern" facet when a parent type already declares a "pattern" facet 2) a user-defined facet when another user-defined facet has the same value. In these cases, an invalid type declaration occurs.
From my point of view, it is better to imagine that we create derived type in two steps:
Create derived type with inherited options
Override options with provided by user
So, from my point of view, it is valid when we define Parent type string with pattern, derive from it and also define pattern. This is explicit re-assignment.
But it is not valid when we have two parents with different patterns - there would be a conflict.
The same for multipleOf and format facets for numbers. Please clarify what parsers should do with multiple definitions in parent classes.
What should happen if i define number type with minimum, maximum and multipleOf float values facets, and then make derived integer type class. Should all values be implicitly rounded?
Each type has a lot of facets, e.g.
displayName
and others. What should happen if we create derived type? Should we inherit only fields, that affect validation result?I mean should derived type inherit
required
anddefault
options? In which order?I used workbench, that uses
raml-js-parser2
under the hood and i see thatrequired
anddefault
fields are not inherited (as all other facets likeexample
,examples
,displayName
, etc.).If that is desired behaviour, that should be explicitly declared in the spec.
But from my point this is not valid behaviour.
Imagine i have two type of logins:
I would have to define that UserEmail is required explicitly. Perhaps that is really ok, but that should be clarified in the spec then.
For Union that is quite obvious for me - just validate each type, if any is valid - Union is valid. But multiple inheritance raises a lot of questions.
The text was updated successfully, but these errors were encountered: