Below console.log statement will refer to the built-in node type instead of our own defined type. This probably discards the type and so it is ignored in the output.
JsonSchemaGenerator.prototype.getMainFileSymbols = function (program, onlyIncludeFiles) {
var _this = this;
function includeFile(file) {
if (onlyIncludeFiles === undefined) {
return !file.isDeclarationFile;
}
return onlyIncludeFiles.filter(function (f) { return (0, path_equal_1.pathEqual)(f, file.fileName); }).length > 0;
}
var files = program.getSourceFiles().filter(includeFile);
if (files.length) {
return Object.keys(this.userSymbols).filter(function (key) {
var symbol = _this.userSymbols[key];
console.log(symbol)
if (!symbol || !symbol.declarations || !symbol.declarations.length) {
return false;
}
var node = symbol.declarations[0];
while (node === null || node === void 0 ? void 0 : node.parent) {
node = node.parent;
}
return files.indexOf(node.getSourceFile()) > -1;
});
}
return [];
};
My current workaround is to manually push the symbol name before passing it to the getSchemaForSymbols function. This works but is very error-prone cause we didn't know the UserInfo type was built-in, which might lead to further errors in the future.
When I try to generate a scheme from the following types, only
UserInfoBla
will be generated becauseUserInfo
is a built-in node type.Below
console.log
statement will refer to the built-innode
type instead of our own defined type. This probably discards the type and so it is ignored in the output.My current workaround is to
manually
push the symbol name before passing it to thegetSchemaForSymbols
function. This works but is very error-prone cause we didn't know theUserInfo
type was built-in, which might lead to further errors in the future.