raml-typesystem
Advanced tools
Comparing version 0.0.49 to 0.0.50
@@ -75,3 +75,4 @@ "use strict"; | ||
if (this._type.isSubTypeOf(ts.UNKNOWN) || this._type.isSubTypeOf(ts.RECURRENT)) { | ||
var p = new typesystem_2.Status(typesystem_2.Status.ERROR, 0, "property " + this.propId() + " refers to unknown type " + this._type.name(), this); | ||
var actualUnknown = actualUnknownType(this._type); | ||
var p = new typesystem_2.Status(typesystem_2.Status.ERROR, 0, "property " + this.propId() + " refers to unknown type " + actualUnknown.name(), this); | ||
p.setValidationPath({ name: this.propId(), child: { name: "type" } }); | ||
@@ -1293,2 +1294,18 @@ return p; | ||
exports.optimize = optimize; | ||
function actualUnknownType(t) { | ||
if (!t.isSubTypeOf(ts.UNKNOWN)) { | ||
return null; | ||
} | ||
if (t.name() != null) { | ||
return t; | ||
} | ||
for (var _i = 0, _a = t.superTypes(); _i < _a.length; _i++) { | ||
var st = _a[_i]; | ||
var ust = actualUnknownType(st); | ||
if (ust != null) { | ||
return ust; | ||
} | ||
} | ||
return t; | ||
} | ||
//# sourceMappingURL=restrictions.js.map |
{ | ||
"name": "raml-typesystem", | ||
"version": "0.0.49", | ||
"version": "0.0.50", | ||
"main": "dist/src/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -79,3 +79,4 @@ /// <reference path="../typings/main.d.ts" /> | ||
if (this._type.isSubTypeOf(ts.UNKNOWN)||this._type.isSubTypeOf(ts.RECURRENT)){ | ||
var p= new Status(Status.ERROR,0,"property "+this.propId()+" refers to unknown type "+this._type.name(),this) | ||
var actualUnknown = actualUnknownType(this._type); | ||
var p= new Status(Status.ERROR,0,"property "+this.propId()+" refers to unknown type "+actualUnknown.name(),this) | ||
p.setValidationPath({name: this.propId(), child: { name: "type"}}) | ||
@@ -1315,2 +1316,19 @@ return p; | ||
return optimized; | ||
} | ||
function actualUnknownType(t:AbstractType):AbstractType{ | ||
if(!t.isSubTypeOf(ts.UNKNOWN)){ | ||
return null; | ||
} | ||
if(t.name()!=null){ | ||
return t; | ||
} | ||
for(var st of t.superTypes()){ | ||
var ust = actualUnknownType(st); | ||
if(ust!=null){ | ||
return ust; | ||
} | ||
} | ||
return t; | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1896939
42273