ts-json-schema-generator
Advanced tools
Comparing version 0.11.0 to 0.12.0
@@ -78,2 +78,5 @@ "use strict"; | ||
.addNodeParser(new TypeOperatorNodeParser_1.TypeOperatorNodeParser(typeChecker, chainNodeParser)) | ||
.addNodeParser(new UnionNodeParser_1.UnionNodeParser(typeChecker, chainNodeParser)) | ||
.addNodeParser(new IntersectionNodeParser_1.IntersectionNodeParser(typeChecker, chainNodeParser)) | ||
.addNodeParser(new TupleNodeParser_1.TupleNodeParser(typeChecker, chainNodeParser)) | ||
.addNodeParser(withCircular(withExpose(withJsDoc(new TypeAliasNodeParser_1.TypeAliasNodeParser(typeChecker, chainNodeParser))))) | ||
@@ -83,6 +86,3 @@ .addNodeParser(withExpose(withJsDoc(new EnumNodeParser_1.EnumNodeParser(typeChecker)))) | ||
.addNodeParser(withCircular(withExpose(withJsDoc(new TypeLiteralNodeParser_1.TypeLiteralNodeParser(withJsDoc(chainNodeParser)))))) | ||
.addNodeParser(new UnionNodeParser_1.UnionNodeParser(chainNodeParser)) | ||
.addNodeParser(new IntersectionNodeParser_1.IntersectionNodeParser(chainNodeParser)) | ||
.addNodeParser(new ArrayNodeParser_1.ArrayNodeParser(chainNodeParser)) | ||
.addNodeParser(new TupleNodeParser_1.TupleNodeParser(chainNodeParser)); | ||
.addNodeParser(new ArrayNodeParser_1.ArrayNodeParser(chainNodeParser)); | ||
return withTopRef(chainNodeParser); | ||
@@ -89,0 +89,0 @@ } |
@@ -6,6 +6,7 @@ import * as ts from "typescript"; | ||
export declare class IntersectionNodeParser implements SubNodeParser { | ||
private typeChecker; | ||
private childNodeParser; | ||
constructor(childNodeParser: NodeParser); | ||
constructor(typeChecker: ts.TypeChecker, childNodeParser: NodeParser); | ||
supportsNode(node: ts.IntersectionTypeNode): boolean; | ||
createType(node: ts.IntersectionTypeNode, context: Context): BaseType; | ||
} |
@@ -5,4 +5,6 @@ "use strict"; | ||
const IntersectionType_1 = require("../Type/IntersectionType"); | ||
const isHidden_1 = require("../Utils/isHidden"); | ||
class IntersectionNodeParser { | ||
constructor(childNodeParser) { | ||
constructor(typeChecker, childNodeParser) { | ||
this.typeChecker = typeChecker; | ||
this.childNodeParser = childNodeParser; | ||
@@ -14,3 +16,6 @@ } | ||
createType(node, context) { | ||
return new IntersectionType_1.IntersectionType(node.types.map((subnode) => { | ||
const hidden = isHidden_1.referenceHidden(this.typeChecker); | ||
return new IntersectionType_1.IntersectionType(node.types | ||
.filter((subnode) => !hidden(subnode)) | ||
.map((subnode) => { | ||
return this.childNodeParser.createType(subnode, context); | ||
@@ -17,0 +22,0 @@ })); |
@@ -6,6 +6,7 @@ import * as ts from "typescript"; | ||
export declare class TupleNodeParser implements SubNodeParser { | ||
private typeChecker; | ||
private childNodeParser; | ||
constructor(childNodeParser: NodeParser); | ||
constructor(typeChecker: ts.TypeChecker, childNodeParser: NodeParser); | ||
supportsNode(node: ts.TupleTypeNode): boolean; | ||
createType(node: ts.TupleTypeNode, context: Context): BaseType; | ||
} |
@@ -5,4 +5,6 @@ "use strict"; | ||
const TupleType_1 = require("../Type/TupleType"); | ||
const isHidden_1 = require("../Utils/isHidden"); | ||
class TupleNodeParser { | ||
constructor(childNodeParser) { | ||
constructor(typeChecker, childNodeParser) { | ||
this.typeChecker = typeChecker; | ||
this.childNodeParser = childNodeParser; | ||
@@ -14,3 +16,6 @@ } | ||
createType(node, context) { | ||
return new TupleType_1.TupleType(node.elementTypes.map((item) => { | ||
const hidden = isHidden_1.referenceHidden(this.typeChecker); | ||
return new TupleType_1.TupleType(node.elementTypes | ||
.filter((subnode) => !hidden(subnode)) | ||
.map((item) => { | ||
return this.childNodeParser.createType(item, context); | ||
@@ -17,0 +22,0 @@ })); |
@@ -6,6 +6,7 @@ import * as ts from "typescript"; | ||
export declare class UnionNodeParser implements SubNodeParser { | ||
private typeChecker; | ||
private childNodeParser; | ||
constructor(childNodeParser: NodeParser); | ||
constructor(typeChecker: ts.TypeChecker, childNodeParser: NodeParser); | ||
supportsNode(node: ts.UnionTypeNode): boolean; | ||
createType(node: ts.UnionTypeNode, context: Context): BaseType; | ||
} |
@@ -5,4 +5,6 @@ "use strict"; | ||
const UnionType_1 = require("../Type/UnionType"); | ||
const isHidden_1 = require("../Utils/isHidden"); | ||
class UnionNodeParser { | ||
constructor(childNodeParser) { | ||
constructor(typeChecker, childNodeParser) { | ||
this.typeChecker = typeChecker; | ||
this.childNodeParser = childNodeParser; | ||
@@ -14,3 +16,6 @@ } | ||
createType(node, context) { | ||
return new UnionType_1.UnionType(node.types.map((subnode) => { | ||
const hidden = isHidden_1.referenceHidden(this.typeChecker); | ||
return new UnionType_1.UnionType(node.types | ||
.filter((subnode) => !hidden(subnode)) | ||
.map((subnode) => { | ||
return this.childNodeParser.createType(subnode, context); | ||
@@ -17,0 +22,0 @@ })); |
import * as ts from "typescript"; | ||
export declare function isHidden(symbol: ts.Symbol): boolean; | ||
export declare function isNodeHidden(node: ts.Node): boolean | null; | ||
export declare function referenceHidden(typeChecker: ts.TypeChecker): (node: ts.Node) => boolean | null; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ts = require("typescript"); | ||
function isHidden(symbol) { | ||
@@ -12,2 +13,19 @@ const jsDocTags = symbol.getJsDocTags(); | ||
exports.isHidden = isHidden; | ||
function isNodeHidden(node) { | ||
const symbol = node.symbol; | ||
if (!symbol) { | ||
return null; | ||
} | ||
return isHidden(symbol); | ||
} | ||
exports.isNodeHidden = isNodeHidden; | ||
function referenceHidden(typeChecker) { | ||
return function (node) { | ||
if (node.kind === ts.SyntaxKind.TypeReference) { | ||
return isHidden(typeChecker.getSymbolAtLocation(node.typeName)); | ||
} | ||
return isNodeHidden(node); | ||
}; | ||
} | ||
exports.referenceHidden = referenceHidden; | ||
//# sourceMappingURL=isHidden.js.map |
{ | ||
"name": "ts-json-schema-generator", | ||
"version": "0.11.0", | ||
"version": "0.12.0", | ||
"description": "Generate JSON schema from your Typescript sources", | ||
@@ -54,3 +54,3 @@ "main": "dist/index.js", | ||
"@types/mocha": "^2.2.42", | ||
"@types/node": "^8.0.26", | ||
"@types/node": "^8.0.27", | ||
"ajv": "~5.2.2", | ||
@@ -57,0 +57,0 @@ "chai": "~4.1.2", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
242372
304
3445