Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ts-json-schema-generator

Package Overview
Dependencies
Maintainers
1
Versions
337
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.43.0 to 0.44.0

dist/src/Schema/RawType.d.ts

2

dist/src/AnnotationsReader/BasicAnnotationsReader.js

@@ -66,2 +66,4 @@ "use strict";

"maxLength",
"minProperties",
"maxProperties",
"minItems",

@@ -68,0 +70,0 @@ "maxItems",

29

dist/src/Schema/Definition.d.ts

@@ -1,27 +0,2 @@

export declare type RawType = number | boolean | string | null;
export interface Definition {
$ref?: string;
description?: string;
not?: Definition;
allOf?: Definition[];
oneOf?: Definition[];
anyOf?: Definition[];
title?: string;
type?: string | string[];
format?: string;
items?: Definition | Definition[];
minItems?: number;
maxItems?: number;
additionalItems?: Definition;
enum?: (RawType | Definition)[];
default?: RawType | Object;
additionalProperties?: false | Definition;
required?: string[];
propertyOrder?: string[];
properties?: DefinitionMap;
defaultProperties?: string[];
typeof?: "function";
}
export interface DefinitionMap {
[name: string]: Definition;
}
import { JSONSchema6 } from "json-schema";
export declare type Definition = JSONSchema6;

@@ -1,6 +0,2 @@

import { StringMap } from "../Utils/StringMap";
import { Definition } from "./Definition";
export interface Schema extends Definition {
$schema: string;
definitions: StringMap<Definition>;
}
import { JSONSchema6 } from "json-schema";
export declare type Schema = JSONSchema6;

@@ -0,1 +1,2 @@

import { JSONSchema6 } from "json-schema";
import { Definition } from "../Schema/Definition";

@@ -6,3 +7,3 @@ import { SubTypeFormatter } from "../SubTypeFormatter";

import { TypeFormatter } from "../TypeFormatter";
export declare function makeNullable(def: Definition): Definition;
export declare function makeNullable(def: Definition): JSONSchema6;
export declare class AnnotatedTypeFormatter implements SubTypeFormatter {

@@ -9,0 +10,0 @@ private childTypeFormatter;

@@ -9,3 +9,2 @@ import { Definition } from "../Schema/Definition";

getChildren(type: EnumType): BaseType[];
private getValueType;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const EnumType_1 = require("../Type/EnumType");
const typeName_1 = require("../Utils/typeName");
const uniqueArray_1 = require("../Utils/uniqueArray");

@@ -11,3 +12,3 @@ class EnumTypeFormatter {

const values = uniqueArray_1.uniqueArray(type.getValues());
const types = uniqueArray_1.uniqueArray(values.map((value) => this.getValueType(value)));
const types = uniqueArray_1.uniqueArray(values.map(typeName_1.typeName));
return {

@@ -21,7 +22,4 @@ type: types.length === 1 ? types[0] : types,

}
getValueType(value) {
return value === null ? "null" : typeof value;
}
}
exports.EnumTypeFormatter = EnumTypeFormatter;
//# sourceMappingURL=EnumTypeFormatter.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const LiteralType_1 = require("../Type/LiteralType");
const typeName_1 = require("../Utils/typeName");
class LiteralTypeFormatter {

@@ -10,3 +11,3 @@ supportsType(type) {

return {
type: typeof type.getValue(),
type: typeName_1.typeName(type.getValue()),
enum: [type.getValue()],

@@ -13,0 +14,0 @@ };

@@ -6,6 +6,9 @@ "use strict";

const UnionType_1 = require("../Type/UnionType");
const typeName_1 = require("../Utils/typeName");
const uniqueArray_1 = require("../Utils/uniqueArray");
class LiteralUnionTypeFormatter {
supportsType(type) {
return type instanceof UnionType_1.UnionType && this.isLiteralUnion(type);
return (type instanceof UnionType_1.UnionType &&
type.getTypes().length > 0 &&
this.isLiteralUnion(type));
}

@@ -38,3 +41,3 @@ getDefinition(type) {

getLiteralType(value) {
return value instanceof LiteralType_1.LiteralType ? typeof value.getValue() : "null";
return value instanceof LiteralType_1.LiteralType ? typeName_1.typeName(value.getValue()) : "null";
}

@@ -41,0 +44,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const LogicError_1 = require("../Error/LogicError");
const PrimitiveType_1 = require("../Type/PrimitiveType");
const UnionType_1 = require("../Type/UnionType");
const uniqueArray_1 = require("../Utils/uniqueArray");
const BooleanType_1 = require("../Type/BooleanType");
const NullType_1 = require("../Type/NullType");
const NumberType_1 = require("../Type/NumberType");
const PrimitiveType_1 = require("../Type/PrimitiveType");
const StringType_1 = require("../Type/StringType");
const UnionType_1 = require("../Type/UnionType");
const uniqueArray_1 = require("../Utils/uniqueArray");
class PrimitiveUnionTypeFormatter {
supportsType(type) {
return type instanceof UnionType_1.UnionType && this.isPrimitiveUnion(type);
return (type instanceof UnionType_1.UnionType &&
type.getTypes().length > 0 &&
this.isPrimitiveUnion(type));
}

@@ -15,0 +17,0 @@ getDefinition(type) {

@@ -1,4 +0,3 @@

import { Definition } from "../Schema/Definition";
import { BaseType } from "../Type/BaseType";
import { TypeFormatter } from "../TypeFormatter";
export declare function getAllOfDefinitionReducer(childTypeFormatter: TypeFormatter): (definition: Definition, baseType: BaseType) => Definition;
export declare function getAllOfDefinitionReducer(childTypeFormatter: TypeFormatter): (definition: import("json-schema").JSONSchema6, baseType: BaseType) => import("json-schema").JSONSchema6;
{
"name": "ts-json-schema-generator",
"version": "0.43.0",
"version": "0.44.0",
"description": "Generate JSON schema from your Typescript sources",

@@ -49,4 +49,5 @@ "main": "dist/index.js",

"@types/jest": "^24.0.13",
"@types/json-schema": "^7.0.3",
"@types/json-stable-stringify": "^1.0.32",
"@types/node": "^12.0.3",
"@types/node": "^12.0.4",
"ajv": "~6.10.0",

@@ -59,3 +60,3 @@ "chai": "~4.2.0",

"ts-node": "^8.2.0",
"tslint": "~5.16.0"
"tslint": "~5.17.0"
},

@@ -62,0 +63,0 @@ "scripts": {

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