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 9.1.0 to 9.1.1

4

dist/src/normalizer.js

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

rules.set('Add empty `required` property if none is defined', function (schema) {
if (!('required' in schema) && isObjectType(schema)) {
if (isObjectType(schema) && !('required' in schema)) {
schema.required = [];

@@ -42,3 +42,3 @@ }

rules.set('Default additionalProperties to true', function (schema) {
if (!('additionalProperties' in schema) && isObjectType(schema) && schema.patternProperties === undefined) {
if (isObjectType(schema) && !('additionalProperties' in schema) && schema.patternProperties === undefined) {
schema.additionalProperties = true;

@@ -45,0 +45,0 @@ }

{
"name": "json-schema-to-typescript",
"version": "9.1.0",
"version": "9.1.1",
"description": "compile json schema to typescript typings",

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

@@ -94,3 +94,3 @@ # json-schema-to-typescript [![Build Status][build]](https://github.com/bcherny/json-schema-to-typescript/actions?query=branch%3Amaster+workflow%3ACI) [![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. |
| 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 |

@@ -161,3 +161,3 @@ ## CLI

- [x] `patternProperties` (partial support)
- [x] [`extends`](https://github.com/json-schema/json-schema/wiki/Extends)
- [x] [`extends`](https://github.com/json-schema/json-schema/wiki/Extends/014e3cd8692250baad70c361dd81f6119ad0f696)
- [x] `required` properties on objects ([eg](https://github.com/tdegrunt/jsonschema/blob/67c0e27ce9542efde0bf43dc1b2a95dd87df43c3/examples/all.js#L130))

@@ -169,2 +169,7 @@ - [ ] `validateRequired` ([eg](https://github.com/tdegrunt/jsonschema/blob/67c0e27ce9542efde0bf43dc1b2a95dd87df43c3/examples/all.js#L124))

## Custom schema properties:
- `tsType`: Overrides the type that's generated from the schema. Useful for forcing a type to `any` or when using non-standard JSON schema extensions ([eg](https://github.com/sokra/json-schema-to-typescript/blob/f1f40307cf5efa328522bb1c9ae0b0d9e5f367aa/test/e2e/customType.ts)).
- `tsEnumNames`: Overrides the names used for the elements in an enum. Can also be used to create string enums ([eg](https://github.com/johnbillion/wp-json-schemas/blob/647440573e4a675f15880c95fcca513fdf7a2077/schemas/properties/post-status-name.json)).
## Not expressible in TypeScript:

@@ -171,0 +176,0 @@

@@ -38,3 +38,3 @@ import {whiteBright} from 'cli-color'

rules.set('Add empty `required` property if none is defined', schema => {
if (!('required' in schema) && isObjectType(schema)) {
if (isObjectType(schema) && !('required' in schema)) {
schema.required = []

@@ -52,3 +52,3 @@ }

rules.set('Default additionalProperties to true', schema => {
if (!('additionalProperties' in schema) && isObjectType(schema) && schema.patternProperties === undefined) {
if (isObjectType(schema) && !('additionalProperties' in schema) && schema.patternProperties === undefined) {
schema.additionalProperties = true

@@ -55,0 +55,0 @@ }

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