New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ts-json-schema-generator

Package Overview
Dependencies
Maintainers
1
Versions
340
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-json-schema-generator - npm Package Compare versions

Comparing version 0.36.3 to 0.37.0

10

dist/factory/parser.js

@@ -73,10 +73,10 @@ "use strict";

.addNodeParser(new NullLiteralNodeParser_1.NullLiteralNodeParser())
.addNodeParser(new LiteralNodeParser_1.LiteralNodeParser(typeChecker, chainNodeParser))
.addNodeParser(new ParenthesizedNodeParser_1.ParenthesizedNodeParser(typeChecker, chainNodeParser))
.addNodeParser(new LiteralNodeParser_1.LiteralNodeParser(chainNodeParser))
.addNodeParser(new ParenthesizedNodeParser_1.ParenthesizedNodeParser(chainNodeParser))
.addNodeParser(new TypeReferenceNodeParser_1.TypeReferenceNodeParser(typeChecker, chainNodeParser))
.addNodeParser(new ExpressionWithTypeArgumentsNodeParser_1.ExpressionWithTypeArgumentsNodeParser(typeChecker, chainNodeParser))
.addNodeParser(new IndexedAccessTypeNodeParser_1.IndexedAccessTypeNodeParser(typeChecker, chainNodeParser))
.addNodeParser(new IndexedAccessTypeNodeParser_1.IndexedAccessTypeNodeParser(chainNodeParser))
.addNodeParser(new TypeofNodeParser_1.TypeofNodeParser(typeChecker, chainNodeParser))
.addNodeParser(new MappedTypeNodeParser_1.MappedTypeNodeParser(typeChecker, chainNodeParser))
.addNodeParser(new TypeOperatorNodeParser_1.TypeOperatorNodeParser(typeChecker, chainNodeParser))
.addNodeParser(new MappedTypeNodeParser_1.MappedTypeNodeParser(chainNodeParser))
.addNodeParser(new TypeOperatorNodeParser_1.TypeOperatorNodeParser(chainNodeParser))
.addNodeParser(new UnionNodeParser_1.UnionNodeParser(typeChecker, chainNodeParser))

@@ -83,0 +83,0 @@ .addNodeParser(new IntersectionNodeParser_1.IntersectionNodeParser(typeChecker, chainNodeParser))

@@ -5,6 +5,6 @@ import * as ts from "typescript";

private diagnostics;
constructor(diagnostics: ts.Diagnostic[]);
constructor(diagnostics: ReadonlyArray<ts.Diagnostic>);
readonly name: string;
readonly message: string;
getDiagnostics(): ts.Diagnostic[];
getDiagnostics(): ReadonlyArray<ts.Diagnostic>;
}

@@ -6,7 +6,6 @@ import * as ts from "typescript";

export declare class IndexedAccessTypeNodeParser implements SubNodeParser {
private typeChecker;
private childNodeParser;
constructor(typeChecker: ts.TypeChecker, childNodeParser: NodeParser);
constructor(childNodeParser: NodeParser);
supportsNode(node: ts.IndexedAccessTypeNode): boolean;
createType(node: ts.IndexedAccessTypeNode, context: Context): BaseType;
}

@@ -8,4 +8,3 @@ "use strict";

class IndexedAccessTypeNodeParser {
constructor(typeChecker, childNodeParser) {
this.typeChecker = typeChecker;
constructor(childNodeParser) {
this.childNodeParser = childNodeParser;

@@ -12,0 +11,0 @@ }

@@ -38,3 +38,3 @@ "use strict";

return node.members
.filter((property) => property.kind === ts.SyntaxKind.PropertySignature)
.filter(ts.isPropertySignature)
.reduce((result, propertyNode) => {

@@ -51,8 +51,7 @@ const propertySymbol = propertyNode.symbol;

getAdditionalProperties(node, context) {
const property = node.members.find((it) => it.kind === ts.SyntaxKind.IndexSignature);
if (!property) {
const indexSignature = node.members.find(ts.isIndexSignatureDeclaration);
if (!indexSignature) {
return false;
}
const signature = property;
return this.childNodeParser.createType(signature.type, context);
return this.childNodeParser.createType(indexSignature.type, context);
}

@@ -59,0 +58,0 @@ getTypeId(node, context) {

@@ -6,7 +6,6 @@ import * as ts from "typescript";

export declare class LiteralNodeParser implements SubNodeParser {
private typeChecker;
private childNodeParser;
constructor(typeChecker: ts.TypeChecker, childNodeParser: NodeParser);
constructor(childNodeParser: NodeParser);
supportsNode(node: ts.LiteralTypeNode): boolean;
createType(node: ts.LiteralTypeNode, context: Context): BaseType;
}

@@ -5,4 +5,3 @@ "use strict";

class LiteralNodeParser {
constructor(typeChecker, childNodeParser) {
this.typeChecker = typeChecker;
constructor(childNodeParser) {
this.childNodeParser = childNodeParser;

@@ -9,0 +8,0 @@ }

@@ -6,5 +6,4 @@ import * as ts from "typescript";

export declare class MappedTypeNodeParser implements SubNodeParser {
private typeChecker;
private childNodeParser;
constructor(typeChecker: ts.TypeChecker, childNodeParser: NodeParser);
constructor(childNodeParser: NodeParser);
supportsNode(node: ts.MappedTypeNode): boolean;

@@ -11,0 +10,0 @@ createType(node: ts.MappedTypeNode, context: Context): BaseType;

@@ -11,4 +11,3 @@ "use strict";

class MappedTypeNodeParser {
constructor(typeChecker, childNodeParser) {
this.typeChecker = typeChecker;
constructor(childNodeParser) {
this.childNodeParser = childNodeParser;

@@ -35,3 +34,3 @@ }

return keyListType.getTypes().reduce((result, key) => {
const objectProperty = new ObjectType_1.ObjectProperty(key.getValue(), this.childNodeParser.createType(node.type, this.createSubContext(node, key, context)), !node.questionToken);
const objectProperty = new ObjectType_1.ObjectProperty(key.getValue().toString(), this.childNodeParser.createType(node.type, this.createSubContext(node, key, context)), !node.questionToken);
result.push(objectProperty);

@@ -38,0 +37,0 @@ return result;

@@ -6,7 +6,6 @@ import * as ts from "typescript";

export declare class ParenthesizedNodeParser implements SubNodeParser {
private typeChecker;
private childNodeParser;
constructor(typeChecker: ts.TypeChecker, childNodeParser: NodeParser);
constructor(childNodeParser: NodeParser);
supportsNode(node: ts.ParenthesizedTypeNode): boolean;
createType(node: ts.ParenthesizedTypeNode, context: Context): BaseType;
}

@@ -5,4 +5,3 @@ "use strict";

class ParenthesizedNodeParser {
constructor(typeChecker, childNodeParser) {
this.typeChecker = typeChecker;
constructor(childNodeParser) {
this.childNodeParser = childNodeParser;

@@ -9,0 +8,0 @@ }

@@ -18,3 +18,3 @@ "use strict";

return node.members
.filter((property) => property.kind === ts.SyntaxKind.PropertySignature)
.filter(ts.isPropertySignature)
.reduce((result, propertyNode) => {

@@ -31,8 +31,7 @@ const propertySymbol = propertyNode.symbol;

getAdditionalProperties(node, context) {
const property = node.members.find((it) => it.kind === ts.SyntaxKind.IndexSignature);
if (!property) {
const indexSignature = node.members.find(ts.isIndexSignatureDeclaration);
if (!indexSignature) {
return false;
}
const signature = property;
return this.childNodeParser.createType(signature.type, context);
return this.childNodeParser.createType(indexSignature.type, context);
}

@@ -39,0 +38,0 @@ getTypeId(node, context) {

@@ -6,7 +6,6 @@ import * as ts from "typescript";

export declare class TypeOperatorNodeParser implements SubNodeParser {
private typeChecker;
private childNodeParser;
constructor(typeChecker: ts.TypeChecker, childNodeParser: NodeParser);
constructor(childNodeParser: NodeParser);
supportsNode(node: ts.TypeOperatorNode): boolean;
createType(node: ts.TypeOperatorNode, context: Context): BaseType;
}

@@ -7,4 +7,3 @@ "use strict";

class TypeOperatorNodeParser {
constructor(typeChecker, childNodeParser) {
this.typeChecker = typeChecker;
constructor(childNodeParser) {
this.childNodeParser = childNodeParser;

@@ -11,0 +10,0 @@ }

@@ -7,14 +7,4 @@ "use strict";

const UnknownNodeError_1 = require("../Error/UnknownNodeError");
function getSourceFile(node) {
let sourceFile = node.parent;
while (sourceFile) {
if (sourceFile.kind === ts.SyntaxKind.SourceFile) {
return sourceFile;
}
sourceFile = sourceFile.parent;
}
return undefined;
}
function getNodeLocation(node) {
const sourceFile = getSourceFile(node);
const sourceFile = node.getSourceFile();
if (!sourceFile) {

@@ -21,0 +11,0 @@ return ["<unknown file>", 0, 0];

{
"name": "ts-json-schema-generator",
"version": "0.36.3",
"version": "0.37.0",
"description": "Generate JSON schema from your Typescript sources",

@@ -44,3 +44,3 @@ "main": "dist/index.js",

"json-stable-stringify": "^1.0.1",
"typescript": "^3.1.6"
"typescript": "^3.2.1"
},

@@ -53,4 +53,4 @@ "devDependencies": {

"@types/mocha": "^5.2.5",
"@types/node": "10.12.5",
"ajv": "~6.5.5",
"@types/node": "10.12.12",
"ajv": "~6.6.1",
"chai": "~4.2.0",

@@ -60,3 +60,3 @@ "jest": "^23.6.0",

"source-map-support": "~0.5.9",
"ts-jest": "^23.10.4",
"ts-jest": "^23.10.5",
"ts-node": "^7.0.1",

@@ -63,0 +63,0 @@ "tslint": "~5.11.0"

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc