diff --git a/lib/typson-schema.js b/lib/typson-schema.js index e3154a9..d8144a1 100755 --- a/lib/typson-schema.js +++ b/lib/typson-schema.js @@ -130,7 +130,7 @@ var TypeScript, _, traverse; // from global scope copyComment(type, definition); definition.properties = {}; - mergeInheritedProperties(type, definition, definitions); + mergeInheritedProperties(type, definition, definitions, modulePath); handlePropertyDeclaration(type, definition, definitions, refPath); _.defaults(definition, defaultProperties); } @@ -236,14 +236,24 @@ var TypeScript, _, traverse; // from global scope * @param definition {object} the definition to be provisionned * @param definitions {object} the set of handled interface and enum definitions */ - function mergeInheritedProperties(type, definition, definitions) { + function mergeInheritedProperties(type, definition, definitions, modulePath) { if (type.extendsList) { _.each(type.extendsList.members, function (superType) { - var superDefinition = definitions.interfaces[superType.actualText]; + var modulePath_ = modulePath ? modulePath : ""; + var superDefinition; + if (definitions.interfaces[modulePath_ + superType.actualText]) { + superDefinition = definitions.interfaces[modulePath_ + superType.actualText]; + } else if(superType.operand1 && + superType.operand2 && + definitions.interfaces[superType.operand1.actualText + "." + superType.operand2.actualText]) { + superDefinition = definitions.interfaces[superType.operand1.actualText + "." + superType.operand2.actualText]; + } else { + superDefinition = definitions.interfaces[superType.actualText]; + } // does the provisionning if a definition exists for the current super type if (superDefinition) { // recursive call - mergeInheritedProperties(superType, definition, definitions); + mergeInheritedProperties(superType, definition, definitions, modulePath); // merges properties for(var superKey in superDefinition.properties) { definition.properties[superKey] = superDefinition.properties[superKey];