Socket
Socket
Sign inDemoInstall

json-schema-to-typescript

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-schema-to-typescript - npm Package Compare versions

Comparing version 15.0.1 to 15.0.2

3

dist/src/applySchemaTyping.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.applySchemaTyping = void 0;
exports.applySchemaTyping = applySchemaTyping;
const JSONSchema_1 = require("./types/JSONSchema");

@@ -49,3 +49,2 @@ const typesOfSchema_1 = require("./typesOfSchema");

}
exports.applySchemaTyping = applySchemaTyping;
//# sourceMappingURL=applySchemaTyping.js.map

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.format = void 0;
exports.format = format;
const prettier_1 = require("prettier");

@@ -23,3 +23,2 @@ function format(code, options) {

}
exports.format = format;
//# sourceMappingURL=formatter.js.map

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

/// <reference types="lodash" />
import { Options } from './index';

@@ -3,0 +2,0 @@ import { AST } from './types/AST';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateType = exports.generate = void 0;
exports.generateType = void 0;
exports.generate = generate;
const lodash_1 = require("lodash");

@@ -18,3 +19,2 @@ const index_1 = require("./index");

}
exports.generate = generate;
function declareEnums(ast, options, processed = new Set()) {

@@ -21,0 +21,0 @@ if (processed.has(ast)) {

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.ValidationError = exports.compile = exports.compileFromFile = exports.DEFAULT_OPTIONS = void 0;
exports.ValidationError = exports.DEFAULT_OPTIONS = void 0;
exports.compileFromFile = compileFromFile;
exports.compile = compile;
const fs_1 = require("fs");

@@ -61,3 +63,2 @@ const lodash_1 = require("lodash");

}
exports.compileFromFile = compileFromFile;
function parseAsJSONSchema(filename) {

@@ -117,3 +118,2 @@ const contents = (0, utils_1.Try)(() => (0, fs_1.readFileSync)(filename), () => {

}
exports.compile = compile;
class ValidationError extends Error {

@@ -120,0 +120,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.link = void 0;
exports.link = link;
const JSONSchema_1 = require("./types/JSONSchema");

@@ -34,3 +34,2 @@ const lodash_1 = require("lodash");

}
exports.link = link;
//# sourceMappingURL=linker.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.normalize = void 0;
exports.normalize = normalize;
const JSONSchema_1 = require("./types/JSONSchema");

@@ -215,3 +215,2 @@ const utils_1 = require("./utils");

}
exports.normalize = normalize;
//# sourceMappingURL=normalizer.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.optimize = void 0;
exports.optimize = optimize;
const lodash_1 = require("lodash");

@@ -61,3 +61,2 @@ const generator_1 = require("./generator");

}
exports.optimize = optimize;
// TODO: More clearly disambiguate standalone names vs. aliased names instead.

@@ -64,0 +63,0 @@ function omitStandaloneName(ast) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateOptions = void 0;
exports.validateOptions = validateOptions;
function validateOptions({ maxItems }) {

@@ -9,3 +9,2 @@ if (maxItems !== undefined && maxItems < -1) {

}
exports.validateOptions = validateOptions;
//# sourceMappingURL=optionValidator.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parse = void 0;
exports.parse = parse;
const lodash_1 = require("lodash");

@@ -35,3 +35,2 @@ const util_1 = require("util");

}
exports.parse = parse;
function parseAsTypeWithCache(schema, type, options, keyName, processed = new Map(), usedNames = new Set()) {

@@ -38,0 +37,0 @@ // If we've seen this node before, return it.

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.dereference = void 0;
exports.dereference = dereference;
const json_schema_ref_parser_1 = require("@apidevtools/json-schema-ref-parser");

@@ -27,3 +27,2 @@ const utils_1 = require("./utils");

}
exports.dereference = dereference;
//# sourceMappingURL=resolver.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.T_UNKNOWN_ADDITIONAL_PROPERTIES = exports.T_UNKNOWN = exports.T_ANY_ADDITIONAL_PROPERTIES = exports.T_ANY = exports.hasStandaloneName = exports.hasComment = void 0;
exports.T_UNKNOWN_ADDITIONAL_PROPERTIES = exports.T_UNKNOWN = exports.T_ANY_ADDITIONAL_PROPERTIES = exports.T_ANY = void 0;
exports.hasComment = hasComment;
exports.hasStandaloneName = hasStandaloneName;
function hasComment(ast) {

@@ -9,7 +11,5 @@ return (('comment' in ast && ast.comment != null && ast.comment !== '') ||

}
exports.hasComment = hasComment;
function hasStandaloneName(ast) {
return 'standaloneName' in ast && ast.standaloneName != null && ast.standaloneName !== '';
}
exports.hasStandaloneName = hasStandaloneName;
//////////////////////////////////////////// literals

@@ -16,0 +16,0 @@ exports.T_ANY = {

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

/// <reference types="lodash" />
import { JSONSchema4, JSONSchema4Type, JSONSchema4TypeName } from 'json-schema';

@@ -3,0 +2,0 @@ export type SchemaType = 'ALL_OF' | 'UNNAMED_SCHEMA' | 'ANY' | 'ANY_OF' | 'BOOLEAN' | 'NAMED_ENUM' | 'NAMED_SCHEMA' | 'NEVER' | 'NULL' | 'NUMBER' | 'STRING' | 'OBJECT' | 'ONE_OF' | 'TYPED_ARRAY' | 'REFERENCE' | 'UNION' | 'UNNAMED_ENUM' | 'UNTYPED_ARRAY' | 'CUSTOM_TYPE';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isCompound = exports.isPrimitive = exports.isBoolean = exports.getRootSchema = exports.Intersection = exports.Types = exports.Parent = void 0;
exports.getRootSchema = exports.Intersection = exports.Types = exports.Parent = void 0;
exports.isBoolean = isBoolean;
exports.isPrimitive = isPrimitive;
exports.isCompound = isCompound;
const lodash_1 = require("lodash");

@@ -18,11 +21,8 @@ exports.Parent = Symbol('Parent');

}
exports.isBoolean = isBoolean;
function isPrimitive(schema) {
return !(0, lodash_1.isPlainObject)(schema);
}
exports.isPrimitive = isPrimitive;
function isCompound(schema) {
return Array.isArray(schema.type) || 'anyOf' in schema || 'oneOf' in schema;
}
exports.isCompound = isCompound;
//# sourceMappingURL=JSONSchema.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.typesOfSchema = void 0;
exports.typesOfSchema = typesOfSchema;
const lodash_1 = require("lodash");

@@ -32,3 +32,2 @@ const JSONSchema_1 = require("./types/JSONSchema");

}
exports.typesOfSchema = typesOfSchema;
const matchers = {

@@ -35,0 +34,0 @@ ALL_OF(schema) {

@@ -6,3 +6,16 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.parseFileAsJSONSchema = exports.isSchemaLike = exports.appendToDescription = exports.maybeStripDefault = exports.pathTransform = exports.escapeBlockComment = exports.log = exports.error = exports.generateName = exports.toSafeString = exports.stripExtension = exports.justName = exports.traverse = exports.Try = void 0;
exports.Try = Try;
exports.traverse = traverse;
exports.justName = justName;
exports.stripExtension = stripExtension;
exports.toSafeString = toSafeString;
exports.generateName = generateName;
exports.error = error;
exports.log = log;
exports.escapeBlockComment = escapeBlockComment;
exports.pathTransform = pathTransform;
exports.maybeStripDefault = maybeStripDefault;
exports.appendToDescription = appendToDescription;
exports.isSchemaLike = isSchemaLike;
exports.parseFileAsJSONSchema = parseFileAsJSONSchema;
const lodash_1 = require("lodash");

@@ -21,3 +34,2 @@ const path_1 = require("path");

}
exports.Try = Try;
// keys that shouldn't be traversed by the catchall step

@@ -148,3 +160,2 @@ const BLACKLISTED_KEYS = new Set([

}
exports.traverse = traverse;
/**

@@ -156,3 +167,2 @@ * Eg. `foo/bar/baz.json` => `baz`

}
exports.justName = justName;
/**

@@ -164,3 +174,2 @@ * Avoid appending "js" to top-level unnamed schemas

}
exports.stripExtension = stripExtension;
/**

@@ -190,3 +199,2 @@ * Convert a string that might contain spaces or special characters to one that

}
exports.toSafeString = toSafeString;
function generateName(from, usedNames) {

@@ -210,3 +218,2 @@ let name = toSafeString(from);

}
exports.generateName = generateName;
function error(...messages) {

@@ -219,3 +226,2 @@ var _a;

}
exports.error = error;
function log(style, title, ...messages) {

@@ -235,3 +241,2 @@ var _a, _b;

}
exports.log = log;
function getStyledTextForLogging(style) {

@@ -273,3 +278,2 @@ var _a, _b, _c, _d, _e, _f, _g;

}
exports.escapeBlockComment = escapeBlockComment;
/*

@@ -292,3 +296,2 @@ the following logic determines the out path by comparing the in path to the users specified out path.

}
exports.pathTransform = pathTransform;
/**

@@ -340,3 +343,2 @@ * Removes the schema's `default` property if it doesn't match the schema's `type` property.

}
exports.maybeStripDefault = maybeStripDefault;
function appendToDescription(existingDescription, ...values) {

@@ -348,3 +350,2 @@ if (existingDescription) {

}
exports.appendToDescription = appendToDescription;
function isSchemaLike(schema) {

@@ -377,3 +378,2 @@ if (!(0, lodash_1.isPlainObject)(schema)) {

}
exports.isSchemaLike = isSchemaLike;
function parseFileAsJSONSchema(filename, contents) {

@@ -389,3 +389,2 @@ if (filename != null && isYaml(filename)) {

}
exports.parseFileAsJSONSchema = parseFileAsJSONSchema;
function isYaml(filename) {

@@ -392,0 +391,0 @@ return filename.endsWith('.yaml') || filename.endsWith('.yml');

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validate = void 0;
exports.validate = validate;
const utils_1 = require("./utils");

@@ -50,3 +50,2 @@ const rules = new Map();

}
exports.validate = validate;
//# sourceMappingURL=validator.js.map
{
"name": "json-schema-to-typescript",
"version": "15.0.1",
"version": "15.0.2",
"description": "compile json schema to typescript typings",

@@ -53,2 +53,3 @@ "main": "dist/src/index.js",

"@types/json-schema": "^7.0.15",
"@types/lodash": "^4.17.7",
"glob": "^10.3.12",

@@ -65,3 +66,2 @@ "is-glob": "^4.0.3",

"@types/js-yaml": "^4.0.9",
"@types/lodash": "^4.17.0",
"@types/minimist": "^1.2.5",

@@ -68,0 +68,0 @@ "@types/node": "^20.12.7",

@@ -7,3 +7,3 @@ {

"DOM",
"es2015",
"es2015"
],

@@ -10,0 +10,0 @@ "module": "commonjs",

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