json-schema-to-typescript
Advanced tools
Comparing version 10.0.3 to 10.1.0
@@ -5,2 +5,6 @@ # Changelog | ||
## 10.1.0 | ||
- ec78099 Feat: Add support for JSON Schema `const` and `$defs` keywords (#263) | ||
## 10.0.0 | ||
@@ -7,0 +11,0 @@ |
@@ -115,2 +115,14 @@ "use strict"; | ||
}); | ||
rules.set('Transform $defs to definitions', function (schema) { | ||
if (schema.$defs) { | ||
schema.definitions = schema.$defs; | ||
delete schema.$defs; | ||
} | ||
}); | ||
rules.set('Transform const to singleton enum', function (schema) { | ||
if (schema.const) { | ||
schema.enum = [schema.const]; | ||
delete schema.const; | ||
} | ||
}); | ||
function normalize(rootSchema, filename, options) { | ||
@@ -117,0 +129,0 @@ rules.forEach(function (rule) { return utils_1.traverse(rootSchema, function (schema) { return rule(schema, filename, options); }); }); |
{ | ||
"name": "json-schema-to-typescript", | ||
"version": "10.0.3", | ||
"version": "10.1.0", | ||
"description": "compile json schema to typescript typings", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
@@ -134,2 +134,16 @@ import {JSONSchemaTypeName, LinkedJSONSchema, NormalizedJSONSchema, Parent} from './types/JSONSchema' | ||
rules.set('Transform $defs to definitions', schema => { | ||
if (schema.$defs) { | ||
schema.definitions = schema.$defs | ||
delete schema.$defs | ||
} | ||
}) | ||
rules.set('Transform const to singleton enum', schema => { | ||
if (schema.const) { | ||
schema.enum = [schema.const] | ||
delete schema.const | ||
} | ||
}) | ||
export function normalize(rootSchema: LinkedJSONSchema, filename: string, options: Options): NormalizedJSONSchema { | ||
@@ -136,0 +150,0 @@ rules.forEach(rule => traverse(rootSchema, schema => rule(schema, filename, options))) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
199036
4787