typescript-json-schema
Advanced tools
Comparing version
66
api.md
@@ -1064,2 +1064,25 @@ _Auto-generated file. Updated with NPM deploy. Update manually with 'yarn docs'._ | ||
## [key-in-key-of-multi-underscores](./test/programs/key-in-key-of-multi-underscores) | ||
```ts | ||
type Util = { | ||
__2Underscores: { | ||
utilDeepKey2: string; | ||
}; | ||
___3Underscores: { | ||
utilDeepKey3: string; | ||
}; | ||
____4Underscores: { | ||
utilDeepKey4: string; | ||
}; | ||
}; | ||
export type Main = { | ||
[Key in keyof Util]: { | ||
[key: string]: Util[Key]; | ||
}; | ||
}; | ||
``` | ||
## [key-in-key-of-single](./test/programs/key-in-key-of-single) | ||
@@ -1220,2 +1243,17 @@ | ||
## [no-ref](./test/programs/no-ref) | ||
```ts | ||
type MySubType = { | ||
id: string; | ||
}; | ||
export type MyModule = { | ||
address: MySubType & { extraProp: number }; | ||
address2: MySubType; | ||
address3: MySubType; | ||
}; | ||
``` | ||
## [no-unrelated-definitions](./test/programs/no-unrelated-definitions) | ||
@@ -2003,2 +2041,30 @@ | ||
## [type-union-strict-null-keep-description](./test/programs/type-union-strict-null-keep-description) | ||
```ts | ||
/** | ||
* Description of InnerObject. | ||
*/ | ||
type InnerObject = { | ||
/** | ||
* Description of foo. | ||
*/ | ||
foo: string; | ||
}; | ||
/** | ||
* Description of MyObject. | ||
*/ | ||
type MyObject = { | ||
inner1?: InnerObject; | ||
/** | ||
* Override description. | ||
*/ | ||
inner2?: InnerObject; | ||
}; | ||
``` | ||
## [type-union-tagged](./test/programs/type-union-tagged) | ||
@@ -2005,0 +2071,0 @@ |
@@ -5,6 +5,6 @@ import * as ts from "typescript"; | ||
export declare function getDefaultArgs(): Args; | ||
export type ValidationKeywords = { | ||
export declare type ValidationKeywords = { | ||
[prop: string]: boolean; | ||
}; | ||
export type Args = { | ||
export declare type Args = { | ||
ref: boolean; | ||
@@ -33,6 +33,6 @@ aliasRef: boolean; | ||
}; | ||
export type PartialArgs = Partial<Args>; | ||
export type PrimitiveType = number | boolean | string | null; | ||
type RedefinedFields = "items" | "additionalItems" | "contains" | "properties" | "patternProperties" | "additionalProperties" | "dependencies" | "propertyNames" | "if" | "then" | "else" | "allOf" | "anyOf" | "oneOf" | "not" | "definitions"; | ||
export type DefinitionOrBoolean = Definition | boolean; | ||
export declare type PartialArgs = Partial<Args>; | ||
export declare type PrimitiveType = number | boolean | string | null; | ||
declare type RedefinedFields = "items" | "additionalItems" | "contains" | "properties" | "patternProperties" | "additionalProperties" | "dependencies" | "propertyNames" | "if" | "then" | "else" | "allOf" | "anyOf" | "oneOf" | "not" | "definitions"; | ||
export declare type DefinitionOrBoolean = Definition | boolean; | ||
export interface Definition extends Omit<JSONSchema7, RedefinedFields> { | ||
@@ -67,3 +67,3 @@ propertyOrder?: string[]; | ||
} | ||
export type SymbolRef = { | ||
export declare type SymbolRef = { | ||
name: string; | ||
@@ -70,0 +70,0 @@ typeName: string; |
@@ -28,3 +28,3 @@ "use strict"; | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
@@ -728,3 +728,3 @@ if (y = 0, t) op = [op[0] & 2, t.value]; | ||
for (var k in schemas[0]) { | ||
if (schemas[0].hasOwnProperty(k)) { | ||
if (schemas[0].hasOwnProperty(k) && !definition.hasOwnProperty(k)) { | ||
definition[k] = schemas[0][k]; | ||
@@ -831,3 +831,3 @@ } | ||
if (typ.flags & ts.TypeFlags.IndexedAccess) { | ||
var targetName = (_b = (_a = clazzType.mapper) === null || _a === void 0 ? void 0 : _a.target) === null || _b === void 0 ? void 0 : _b.value; | ||
var targetName = ts.escapeLeadingUnderscores((_b = (_a = clazzType.mapper) === null || _a === void 0 ? void 0 : _a.target) === null || _b === void 0 ? void 0 : _b.value); | ||
var indexedAccessType = typ; | ||
@@ -1094,3 +1094,3 @@ var symbols = indexedAccessType.objectType.members; | ||
} | ||
if (this.recursiveTypeRef.get(fullTypeName) === definition && !forceNotRef) { | ||
if (this.recursiveTypeRef.get(fullTypeName) === definition) { | ||
this.recursiveTypeRef.delete(fullTypeName); | ||
@@ -1097,0 +1097,0 @@ if (this.reffedDefinitions[fullTypeName]) { |
{ | ||
"name": "typescript-json-schema", | ||
"version": "0.57.0", | ||
"version": "0.58.0", | ||
"description": "typescript-json-schema generates JSON Schema files from your Typescript sources", | ||
@@ -5,0 +5,0 @@ "main": "dist/typescript-json-schema.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
245145
0.47%