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 10.1.0 to 10.1.1

yarn-error.log

2

dist/src/parser.js

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

// to the parent intersection type, so we remove it from the children.
return parseAsTypeWithCache(lodash_1.omit(schema, 'description', 'id', 'title'), type, options, keyName, processed, usedNames);
return parseAsTypeWithCache(utils_1.maybeStripNameHints(schema), type, options, keyName, processed, usedNames);
});

@@ -47,0 +47,0 @@ utils_1.log('blue', 'parser', 'Types:', types, 'Input:', schema, 'Output:', ast);

@@ -34,2 +34,10 @@ import { JSONSchema, LinkedJSONSchema } from './types/JSONSchema';

export declare function maybeStripDefault(schema: LinkedJSONSchema): LinkedJSONSchema;
/**
* Removes the schema's `id`, `name`, and `description` properties
* if they exist.
* Useful when parsing intersections.
*
* Mutates `schema`.
*/
export declare function maybeStripNameHints(schema: JSONSchema): JSONSchema;
export {};

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

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

@@ -343,2 +343,22 @@ var path_1 = require("path");

exports.maybeStripDefault = maybeStripDefault;
/**
* Removes the schema's `id`, `name`, and `description` properties
* if they exist.
* Useful when parsing intersections.
*
* Mutates `schema`.
*/
function maybeStripNameHints(schema) {
if ('description' in schema) {
delete schema.description;
}
if ('id' in schema) {
delete schema.id;
}
if ('name' in schema) {
delete schema.name;
}
return schema;
}
exports.maybeStripNameHints = maybeStripNameHints;
//# sourceMappingURL=utils.js.map
{
"name": "json-schema-to-typescript",
"version": "10.1.0",
"version": "10.1.1",
"description": "compile json schema to typescript typings",

@@ -5,0 +5,0 @@ "main": "dist/src/index.js",

@@ -26,3 +26,3 @@ import {JSONSchema4Type, JSONSchema4TypeName} from 'json-schema'

} from './types/JSONSchema'
import {generateName, log, maybeStripDefault} from './utils'
import {generateName, log, maybeStripDefault, maybeStripNameHints} from './utils'

@@ -70,3 +70,3 @@ export type Processed = Map<LinkedJSONSchema, Map<SchemaType, AST>>

// to the parent intersection type, so we remove it from the children.
parseAsTypeWithCache(omit(schema, 'description', 'id', 'title'), type, options, keyName, processed, usedNames)
parseAsTypeWithCache(maybeStripNameHints(schema), type, options, keyName, processed, usedNames)
)

@@ -73,0 +73,0 @@

@@ -344,1 +344,21 @@ import {deburr, isPlainObject, mapValues, trim, upperFirst} from 'lodash'

}
/**
* Removes the schema's `id`, `name`, and `description` properties
* if they exist.
* Useful when parsing intersections.
*
* Mutates `schema`.
*/
export function maybeStripNameHints(schema: JSONSchema): JSONSchema {
if ('description' in schema) {
delete schema.description
}
if ('id' in schema) {
delete schema.id
}
if ('name' in schema) {
delete schema.name
}
return schema
}
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