raml-java-parser icon indicating copy to clipboard operation
raml-java-parser copied to clipboard

Property type specialization does not adhere to RAML spec

Open vsigler opened this issue 8 years ago • 1 comments

The RAML spec says, that when subclassing (suptyping), it is possible to override property definitions by narrowing them (e.g. adding facets or changing type - Number to Integer, etc.). There are 2 problems:

  1. Type name is lost - if parent type has a property of type object and I narrow it down to a custom object type, the final result "forgets" the new type name and uses the one of the parent. This is especially painful when writing a code generator that works with inheritance.
  2. This is much more severe than 1) - according to the spec, "any" type can be specialized to anything, so it is perfectly valid to declare property of type "any" and in a subtype override it to some other type. However, if I do this, I will always get just an instance of AnyTypeDeclaration and the overriding is completely ignored.

Aha! Link: https://mulesoft-roadmap.aha.io/features/APIRAML-86

vsigler avatar Jun 06 '17 06:06 vsigler

I've had the same problem, the specialized types are not used on the output.

RangelReale avatar Dec 14 '17 21:12 RangelReale