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 7.0.0 to 7.1.0

4

CHANGELOG.md
# Changelog
## 7.1.0
- ddbd627 Add `strictIndexSignatures` CLI option, defaulting to false (#252)
## 7.0.0

@@ -4,0 +8,0 @@

@@ -122,2 +122,9 @@ "use strict";

function generateType(ast, options) {
var type = generateRawType(ast, options);
if (options.strictIndexSignatures && ast.keyName === '[k: string]') {
return type + " | undefined";
}
return type;
}
function generateRawType(ast, options) {
utils_1.log(cli_color_1.whiteBright.bgMagenta('generator'), ast);

@@ -124,0 +131,0 @@ if (AST_1.hasStandaloneName(ast)) {

@@ -23,2 +23,8 @@ import { JSONSchema4 } from 'json-schema';

/**
* Append all index signatures with `| undefined` so that they are strictly typed.
*
* This is required to be compatible with `strictNullChecks`.
*/
strictIndexSignatures: boolean;
/**
* A [Prettier](https://prettier.io/docs/en/options.html) configuration.

@@ -25,0 +31,0 @@ */

@@ -79,2 +79,3 @@ "use strict";

enableConstEnums: true,
strictIndexSignatures: false,
style: {

@@ -81,0 +82,0 @@ bracketSpacing: false,

21

package.json
{
"name": "json-schema-to-typescript",
"version": "7.0.0",
"version": "7.1.0",
"description": "compile json schema to typescript typings",

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

"test": "ava --verbose",
"prepublishOnly": "npm test",
"pretest": "npm run build",

@@ -51,7 +50,7 @@ "watch": "tsc -w",

"@types/node": ">=4.5.0",
"@types/prettier": "^1.18.0",
"@types/prettier": "^1.16.1",
"cli-color": "^1.4.0",
"json-schema-ref-parser": "^7.1.0",
"json-schema-ref-parser": "^6.1.0",
"json-stringify-safe": "^5.0.1",
"lodash": "^4.17.15",
"lodash": "^4.17.11",
"minimist": "^1.2.0",

@@ -64,13 +63,13 @@ "mz": "^2.7.0",

"@types/cli-color": "^0.3.29",
"@types/lodash": "^4.14.136",
"@types/lodash": "^4.14.121",
"@types/minimist": "^1.2.0",
"@types/mz": "0.0.32",
"ava": "^2.2.0",
"browserify": "^16.3.0",
"ava": "^1.2.1",
"browserify": "^16.2.3",
"browserify-shim": "^3.8.14",
"concurrently": "^4.1.1",
"concurrently": "^4.1.0",
"shx": "^0.3.2",
"tsify": "^4.0.1",
"tslint": "^5.18.0",
"typescript": "^3.5.3"
"tslint": "^5.13.1",
"typescript": "^3.3.3333"
},

@@ -77,0 +76,0 @@ "ava": {

@@ -92,2 +92,3 @@ # json-schema-to-typescript [![Build Status][build]](https://circleci.com/gh/bcherny/json-schema-to-typescript) [![npm]](https://www.npmjs.com/package/json-schema-to-typescript) [![mit]](https://opensource.org/licenses/MIT)

| unreachableDefinitions | boolean | `false` | Generates code for `definitions` that aren't referenced by the schema. |
| strictIndexSignatures | boolean | `false` | Append all index signatures with `| undefined` so that they are strictly typed. |
| $refOptions | object | `{}` | [$RefParser](https://github.com/BigstickCarpet/json-schema-ref-parser) Options, used when resolving `$ref`s |

@@ -94,0 +95,0 @@ ## CLI

@@ -148,2 +148,12 @@ import { whiteBright } from 'cli-color'

function generateType(ast: AST, options: Options): string {
const type = generateRawType(ast, options)
if (options.strictIndexSignatures && ast.keyName === '[k: string]') {
return `${type} | undefined`
}
return type
}
function generateRawType(ast: AST, options: Options): string {
log(whiteBright.bgMagenta('generator'), ast)

@@ -150,0 +160,0 @@

@@ -36,2 +36,8 @@ import { readFileSync } from 'fs'

/**
* Append all index signatures with `| undefined` so that they are strictly typed.
*
* This is required to be compatible with `strictNullChecks`.
*/
strictIndexSignatures: boolean
/**
* A [Prettier](https://prettier.io/docs/en/options.html) configuration.

@@ -61,2 +67,3 @@ */

enableConstEnums: true, // by default, avoid generating code
strictIndexSignatures: false,
style: {

@@ -63,0 +70,0 @@ bracketSpacing: false,

Sorry, the diff of this file is too big to display

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