ts-json-schema-generator
Advanced tools
Comparing version 2.0.2--canary.1925.d1e848f.0 to 2.0.2--canary.1925.d74c6f4.0
{ | ||
"name": "ts-json-schema-generator", | ||
"version": "2.0.2--canary.1925.d1e848f.0", | ||
"version": "2.0.2--canary.1925.d74c6f4.0", | ||
"description": "Generate JSON schema from your Typescript sources", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -37,3 +37,3 @@ import { ChainTypeFormatter } from "../src/ChainTypeFormatter.js"; | ||
formatter: MutableTypeFormatter, | ||
circularReferenceTypeFormatter: CircularReferenceTypeFormatter | ||
circularReferenceTypeFormatter: CircularReferenceTypeFormatter, | ||
) => void; | ||
@@ -40,0 +40,0 @@ |
@@ -79,3 +79,3 @@ import ts from "typescript"; | ||
nodeParser, | ||
new ExtendedAnnotationsReader(typeChecker, extraTags, config.markdownDescription) | ||
new ExtendedAnnotationsReader(typeChecker, extraTags, config.markdownDescription), | ||
); | ||
@@ -153,7 +153,7 @@ } else if (config.jsDoc === "basic") { | ||
withJsDoc(chainNodeParser), | ||
config.additionalProperties | ||
) | ||
) | ||
) | ||
) | ||
config.additionalProperties, | ||
), | ||
), | ||
), | ||
), | ||
) | ||
@@ -164,6 +164,6 @@ .addNodeParser( | ||
withJsDoc( | ||
new TypeLiteralNodeParser(typeChecker, withJsDoc(chainNodeParser), config.additionalProperties) | ||
) | ||
) | ||
) | ||
new TypeLiteralNodeParser(typeChecker, withJsDoc(chainNodeParser), config.additionalProperties), | ||
), | ||
), | ||
), | ||
) | ||
@@ -170,0 +170,0 @@ |
@@ -28,3 +28,3 @@ import * as glob from "glob"; | ||
{}, | ||
configFile | ||
configFile, | ||
); | ||
@@ -31,0 +31,0 @@ parseResult.options.noEmit = true; |
{ | ||
"name": "ts-json-schema-generator", | ||
"version": "2.0.2--canary.1925.d1e848f.0", | ||
"version": "2.0.2--canary.1925.d74c6f4.0", | ||
"description": "Generate JSON schema from your Typescript sources", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -11,3 +11,3 @@ import json5 from "json5"; | ||
extraTags?: Set<string>, | ||
private markdownDescription?: boolean | ||
private markdownDescription?: boolean, | ||
) { | ||
@@ -14,0 +14,0 @@ super(extraTags); |
@@ -14,3 +14,3 @@ import ts from "typescript"; | ||
protected typeChecker: ts.TypeChecker, | ||
protected nodeParsers: SubNodeParser[] | ||
protected nodeParsers: SubNodeParser[], | ||
) {} | ||
@@ -17,0 +17,0 @@ |
@@ -7,3 +7,3 @@ import ts from "typescript"; | ||
super( | ||
diagnostics.map((diagnostic) => ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")).join("\n\n") | ||
diagnostics.map((diagnostic) => ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")).join("\n\n"), | ||
); | ||
@@ -10,0 +10,0 @@ } |
@@ -7,3 +7,3 @@ import ts from "typescript"; | ||
private node: ts.Node, | ||
private reference?: ts.Node | ||
private reference?: ts.Node, | ||
) { | ||
@@ -13,3 +13,3 @@ super( | ||
ts.SyntaxKind[node.kind] | ||
}"` | ||
}"`, | ||
); | ||
@@ -16,0 +16,0 @@ } |
@@ -15,3 +15,3 @@ import ts from "typescript"; | ||
protected expose: "all" | "none" | "export", | ||
protected jsDoc: "none" | "extended" | "basic" | ||
protected jsDoc: "none" | "extended" | "basic", | ||
) {} | ||
@@ -18,0 +18,0 @@ |
@@ -17,3 +17,3 @@ import ts from "typescript"; | ||
protected childNodeParser: SubNodeParser, | ||
protected annotationsReader: AnnotationsReader | ||
protected annotationsReader: AnnotationsReader, | ||
) {} | ||
@@ -20,0 +20,0 @@ |
@@ -13,3 +13,3 @@ import { TupleType } from "../Type/TupleType.js"; | ||
protected typeChecker: ts.TypeChecker, | ||
protected childNodeParser: NodeParser | ||
protected childNodeParser: NodeParser, | ||
) {} | ||
@@ -16,0 +16,0 @@ |
@@ -13,3 +13,3 @@ import ts from "typescript"; | ||
public parameterName: string, | ||
public type: BaseType | ||
public type: BaseType, | ||
) {} | ||
@@ -21,3 +21,3 @@ } | ||
protected typeChecker: ts.TypeChecker, | ||
protected childNodeParser: NodeParser | ||
protected childNodeParser: NodeParser, | ||
) {} | ||
@@ -41,3 +41,3 @@ | ||
result ? node.trueType : node.falseType, | ||
this.createSubContext(node, context, undefined, result ? inferMap : new Map()) | ||
this.createSubContext(node, context, undefined, result ? inferMap : new Map()), | ||
); | ||
@@ -55,3 +55,3 @@ } | ||
node.trueType, | ||
this.createSubContext(node, context, new CheckType(checkTypeParameterName, trueCheckType), inferMap) | ||
this.createSubContext(node, context, new CheckType(checkTypeParameterName, trueCheckType), inferMap), | ||
); | ||
@@ -65,3 +65,3 @@ if (result) { | ||
node.falseType, | ||
this.createSubContext(node, context, new CheckType(checkTypeParameterName, falseCheckType)) | ||
this.createSubContext(node, context, new CheckType(checkTypeParameterName, falseCheckType)), | ||
); | ||
@@ -105,3 +105,3 @@ if (result) { | ||
checkType?: CheckType, | ||
inferMap: Map<string, BaseType> = new Map() | ||
inferMap: Map<string, BaseType> = new Map(), | ||
): Context { | ||
@@ -108,0 +108,0 @@ const subContext = new Context(node); |
@@ -14,3 +14,3 @@ import ts from "typescript"; | ||
protected childNodeParser: NodeParser, | ||
protected functions: FunctionOptions | ||
protected functions: FunctionOptions, | ||
) {} | ||
@@ -17,0 +17,0 @@ |
@@ -22,3 +22,3 @@ import ts from "typescript"; | ||
.filter((member: ts.EnumMember) => !isNodeHidden(member)) | ||
.map((member, index) => this.getMemberValue(member, index)) | ||
.map((member, index) => this.getMemberValue(member, index)), | ||
); | ||
@@ -25,0 +25,0 @@ } |
@@ -9,3 +9,3 @@ import ts from "typescript"; | ||
protected typeChecker: ts.TypeChecker, | ||
protected childNodeParser: NodeParser | ||
protected childNodeParser: NodeParser, | ||
) {} | ||
@@ -22,3 +22,3 @@ | ||
aliasedSymbol.declarations![0], | ||
this.createSubContext(node, context) | ||
this.createSubContext(node, context), | ||
); | ||
@@ -25,0 +25,0 @@ } else if (typeSymbol.flags & ts.SymbolFlags.TypeParameter) { |
@@ -15,3 +15,3 @@ import ts from "typescript"; | ||
protected childNodeParser: NodeParser, | ||
protected functions: FunctionOptions | ||
protected functions: FunctionOptions, | ||
) {} | ||
@@ -30,3 +30,3 @@ | ||
node: ts.FunctionTypeNode | ts.FunctionExpression | ts.FunctionDeclaration | ts.ArrowFunction, | ||
context: Context | ||
context: Context, | ||
): BaseType { | ||
@@ -52,3 +52,3 @@ if (this.functions === "hide") { | ||
| ts.ConstructorTypeNode, | ||
context: Context | ||
context: Context, | ||
) { | ||
@@ -72,3 +72,3 @@ if (node.parameters.length === 0) { | ||
}), | ||
false | ||
false, | ||
); | ||
@@ -83,3 +83,3 @@ } | ||
| ts.ArrowFunction | ||
| ts.ConstructorTypeNode | ||
| ts.ConstructorTypeNode, | ||
): string | undefined { | ||
@@ -86,0 +86,0 @@ if (ts.isArrowFunction(node) || ts.isFunctionExpression(node) || ts.isFunctionTypeNode(node)) { |
@@ -19,3 +19,3 @@ import ts from "typescript"; | ||
protected typeChecker: ts.TypeChecker, | ||
protected childNodeParser: NodeParser | ||
protected childNodeParser: NodeParser, | ||
) {} | ||
@@ -40,3 +40,3 @@ | ||
ts.isIdentifier(m.name) && | ||
m.name.text === indexType.getValue() | ||
m.name.text === indexType.getValue(), | ||
); | ||
@@ -67,3 +67,3 @@ | ||
throw new LogicError( | ||
`Unexpected type "${type.getId()}" (expected "LiteralType.js" or "StringType.js" or "NumberType.js")` | ||
`Unexpected type "${type.getId()}" (expected "LiteralType.js" or "StringType.js" or "NumberType.js")`, | ||
); | ||
@@ -70,0 +70,0 @@ } |
@@ -10,3 +10,3 @@ import ts from "typescript"; | ||
protected typeChecker: ts.TypeChecker, | ||
protected childNodeParser: NodeParser | ||
protected childNodeParser: NodeParser, | ||
) {} | ||
@@ -13,0 +13,0 @@ |
@@ -17,3 +17,3 @@ import ts, { PropertyName } from "typescript"; | ||
protected childNodeParser: NodeParser, | ||
protected readonly additionalProperties: boolean | ||
protected readonly additionalProperties: boolean, | ||
) {} | ||
@@ -28,3 +28,3 @@ | ||
context: Context, | ||
reference?: ReferenceType | ||
reference?: ReferenceType, | ||
): BaseType { | ||
@@ -102,3 +102,3 @@ if (node.typeParameters?.length) { | ||
], | ||
[] | ||
[], | ||
); | ||
@@ -109,3 +109,3 @@ } | ||
node: ts.InterfaceDeclaration | ts.ClassDeclaration, | ||
context: Context | ||
context: Context, | ||
): ObjectProperty[] | undefined { | ||
@@ -119,3 +119,3 @@ let hasRequiredNever = false; | ||
const params = member.parameters.filter((param) => | ||
ts.isParameterPropertyDeclaration(param, param.parent) | ||
ts.isParameterPropertyDeclaration(param, param.parent), | ||
) as ts.ParameterPropertyDeclaration[]; | ||
@@ -128,3 +128,3 @@ members.push(...params); | ||
}, | ||
[] as (ts.PropertyDeclaration | ts.PropertySignature | ts.ParameterPropertyDeclaration)[] | ||
[] as (ts.PropertyDeclaration | ts.PropertySignature | ts.ParameterPropertyDeclaration)[], | ||
) | ||
@@ -152,4 +152,4 @@ .filter((member) => isPublic(member) && !isStatic(member) && !isNodeHidden(member)) | ||
this.childNodeParser.createType(memberType, context), | ||
!member.questionToken | ||
) | ||
!member.questionToken, | ||
), | ||
) | ||
@@ -173,3 +173,3 @@ .filter((prop) => { | ||
node: ts.InterfaceDeclaration | ts.ClassDeclaration, | ||
context: Context | ||
context: Context, | ||
): BaseType | boolean { | ||
@@ -176,0 +176,0 @@ const indexSignature = (node.members as ts.NodeArray<ts.NamedDeclaration>).find(ts.isIndexSignatureDeclaration); |
@@ -16,3 +16,3 @@ import ts from "typescript"; | ||
protected typeChecker: ts.TypeChecker, | ||
protected childNodeParser: NodeParser | ||
protected childNodeParser: NodeParser, | ||
) {} | ||
@@ -19,0 +19,0 @@ |
@@ -25,3 +25,3 @@ import ts from "typescript"; | ||
protected childNodeParser: NodeParser, | ||
protected readonly additionalProperties: boolean | ||
protected readonly additionalProperties: boolean, | ||
) {} | ||
@@ -44,3 +44,3 @@ | ||
this.getProperties(node, keyListType, context), | ||
this.getAdditionalProperties(node, keyListType, context) | ||
this.getAdditionalProperties(node, keyListType, context), | ||
); | ||
@@ -58,3 +58,3 @@ } else if (keyListType instanceof LiteralType) { | ||
node.type!, | ||
this.createSubContext(node, keyListType, context) | ||
this.createSubContext(node, keyListType, context), | ||
); | ||
@@ -91,3 +91,3 @@ return type instanceof NeverType ? new NeverType() : new ArrayType(type); | ||
constraintType ? constraintType.getId() : constraintType | ||
}" for type "${node.getText()}" (expected "UnionType" or "StringType")` | ||
}" for type "${node.getText()}" (expected "UnionType" or "StringType")`, | ||
); | ||
@@ -102,3 +102,3 @@ } | ||
const key = derefType( | ||
this.childNodeParser.createType(node.nameType, this.createSubContext(node, rawKey, context)) | ||
this.childNodeParser.createType(node.nameType, this.createSubContext(node, rawKey, context)), | ||
); | ||
@@ -118,3 +118,3 @@ | ||
node.type!, | ||
this.createSubContext(node, key, context) | ||
this.createSubContext(node, key, context), | ||
); | ||
@@ -133,3 +133,3 @@ | ||
preserveAnnotation(propertyType, newType), | ||
!node.questionToken && !hasUndefined | ||
!node.questionToken && !hasUndefined, | ||
); | ||
@@ -149,3 +149,3 @@ | ||
node.type!, | ||
this.createSubContext(node, new LiteralType(value!), context) | ||
this.createSubContext(node, new LiteralType(value!), context), | ||
); | ||
@@ -160,3 +160,3 @@ | ||
keyListType: UnionType, | ||
context: Context | ||
context: Context, | ||
): BaseType | boolean { | ||
@@ -177,3 +177,3 @@ const key = keyListType.getTypes().filter((type) => !(type instanceof LiteralType))[0]; | ||
key: LiteralType | StringType, | ||
parentContext: Context | ||
parentContext: Context, | ||
): Context { | ||
@@ -180,0 +180,0 @@ const subContext = new Context(node); |
@@ -22,4 +22,4 @@ import { NodeParser } from "../NodeParser.js"; | ||
this.childNodeParser.createType((t as any).initializer, context), | ||
!(t as any).questionToken | ||
) | ||
!(t as any).questionToken, | ||
), | ||
); | ||
@@ -26,0 +26,0 @@ |
@@ -31,3 +31,3 @@ import ts from "typescript"; | ||
throw new Error( | ||
`Expected operand to be "LiteralType" but is "${operand ? operand.constructor.name : operand}"` | ||
`Expected operand to be "LiteralType" but is "${operand ? operand.constructor.name : operand}"`, | ||
); | ||
@@ -34,0 +34,0 @@ } |
@@ -9,3 +9,3 @@ import ts from "typescript"; | ||
protected typeChecker: ts.TypeChecker, | ||
protected childNodeParser: NodeParser | ||
protected childNodeParser: NodeParser, | ||
) {} | ||
@@ -12,0 +12,0 @@ |
@@ -31,3 +31,3 @@ import ts from "typescript"; | ||
return extractLiterals(type).map((value) => value + suffix); | ||
}) | ||
}), | ||
); | ||
@@ -34,0 +34,0 @@ |
@@ -10,3 +10,3 @@ import ts from "typescript"; | ||
protected typeChecker: ts.TypeChecker, | ||
protected childNodeParser: NodeParser | ||
protected childNodeParser: NodeParser, | ||
) {} | ||
@@ -22,5 +22,5 @@ | ||
return this.childNodeParser.createType(item, context); | ||
}) | ||
}), | ||
); | ||
} | ||
} |
@@ -13,3 +13,3 @@ import ts from "typescript"; | ||
protected typeChecker: ts.TypeChecker, | ||
protected childNodeParser: NodeParser | ||
protected childNodeParser: NodeParser, | ||
) {} | ||
@@ -16,0 +16,0 @@ |
@@ -15,3 +15,3 @@ import ts, { MethodSignature, PropertySignature } from "typescript"; | ||
protected childNodeParser: NodeParser, | ||
protected readonly additionalProperties: boolean | ||
protected readonly additionalProperties: boolean, | ||
) {} | ||
@@ -44,3 +44,3 @@ | ||
(element): element is PropertySignature | MethodSignature => | ||
ts.isPropertySignature(element) || ts.isMethodSignature(element) | ||
ts.isPropertySignature(element) || ts.isMethodSignature(element), | ||
) | ||
@@ -53,4 +53,4 @@ .filter((propertyNode) => !isNodeHidden(propertyNode)) | ||
this.childNodeParser.createType(propertyNode.type!, context), | ||
!propertyNode.questionToken | ||
) | ||
!propertyNode.questionToken, | ||
), | ||
) | ||
@@ -57,0 +57,0 @@ .filter((prop) => { |
@@ -16,3 +16,3 @@ import ts from "typescript"; | ||
protected typeChecker: ts.TypeChecker, | ||
protected childNodeParser: NodeParser | ||
protected childNodeParser: NodeParser, | ||
) {} | ||
@@ -19,0 +19,0 @@ |
@@ -19,3 +19,3 @@ import ts from "typescript"; | ||
protected typeChecker: ts.TypeChecker, | ||
protected childNodeParser: NodeParser | ||
protected childNodeParser: NodeParser, | ||
) {} | ||
@@ -77,3 +77,3 @@ | ||
typeSymbol.declarations!.filter((n: ts.Declaration) => !invalidTypes[n.kind])[0], | ||
this.createSubContext(node, context) | ||
this.createSubContext(node, context), | ||
); | ||
@@ -80,0 +80,0 @@ } |
@@ -12,3 +12,3 @@ import ts from "typescript"; | ||
protected typeChecker: ts.TypeChecker, | ||
protected childNodeParser: NodeParser | ||
protected childNodeParser: NodeParser, | ||
) {} | ||
@@ -15,0 +15,0 @@ |
@@ -20,3 +20,3 @@ import ts from "typescript"; | ||
protected readonly typeFormatter: TypeFormatter, | ||
protected readonly config?: Config | ||
protected readonly config?: Config, | ||
) {} | ||
@@ -136,3 +136,3 @@ | ||
typeChecker: ts.TypeChecker, | ||
types: Map<string, ts.Node> | ||
types: Map<string, ts.Node>, | ||
): void { | ||
@@ -139,0 +139,0 @@ for (const sourceFile of sourceFiles) { |
@@ -10,3 +10,3 @@ import ts from "typescript"; | ||
protected fullName: string | undefined, | ||
protected topRef: boolean | ||
protected topRef: boolean, | ||
) {} | ||
@@ -13,0 +13,0 @@ |
@@ -6,3 +6,3 @@ import { BaseType } from "./BaseType.js"; | ||
private id: string, | ||
private type: BaseType | ||
private type: BaseType, | ||
) { | ||
@@ -9,0 +9,0 @@ super(); |
@@ -12,3 +12,3 @@ import { BaseType } from "./BaseType.js"; | ||
private annotations: Annotations, | ||
private nullable: boolean | ||
private nullable: boolean, | ||
) { | ||
@@ -15,0 +15,0 @@ super(); |
@@ -10,3 +10,3 @@ import ts from "typescript"; | ||
node?: ts.ConstructorTypeNode, | ||
protected namedArguments?: ObjectType | ||
protected namedArguments?: ObjectType, | ||
) { | ||
@@ -13,0 +13,0 @@ super(); |
@@ -6,3 +6,3 @@ import { BaseType } from "./BaseType.js"; | ||
private name: string | undefined, | ||
private type: BaseType | ||
private type: BaseType, | ||
) { | ||
@@ -9,0 +9,0 @@ super(); |
@@ -12,3 +12,3 @@ import { BaseType } from "./BaseType.js"; | ||
private id: string, | ||
private values: readonly EnumValue[] | ||
private values: readonly EnumValue[], | ||
) { | ||
@@ -15,0 +15,0 @@ super(); |
@@ -10,3 +10,3 @@ import ts from "typescript"; | ||
node?: ts.FunctionTypeNode | ts.FunctionExpression | ts.FunctionDeclaration | ts.ArrowFunction, | ||
protected namedArguments?: ObjectType | ||
protected namedArguments?: ObjectType, | ||
) { | ||
@@ -13,0 +13,0 @@ super(); |
@@ -8,3 +8,3 @@ import { BaseType } from "./BaseType.js"; | ||
private type: BaseType, | ||
private required: boolean | ||
private required: boolean, | ||
) {} | ||
@@ -30,3 +30,3 @@ | ||
// whether the object is `object` | ||
private nonPrimitive: boolean = false | ||
private nonPrimitive: boolean = false, | ||
) { | ||
@@ -33,0 +33,0 @@ super(); |
@@ -9,3 +9,3 @@ import { ArrayType } from "./ArrayType.js"; | ||
private item: ArrayType | InferType | TupleType, | ||
private title: string | null = null | ||
private title: string | null = null, | ||
) { | ||
@@ -12,0 +12,0 @@ super(); |
@@ -20,3 +20,3 @@ import { BaseType } from "./BaseType.js"; | ||
return flatTypes; | ||
}, [] as BaseType[]) | ||
}, [] as BaseType[]), | ||
); | ||
@@ -23,0 +23,0 @@ } |
@@ -65,4 +65,4 @@ import { Definition } from "../Schema/Definition.js"; | ||
`Cannot assign discriminator tag to type: ${JSON.stringify( | ||
derefed | ||
)}. This tag can only be assigned to union types.` | ||
derefed, | ||
)}. This tag can only be assigned to union types.`, | ||
); | ||
@@ -69,0 +69,0 @@ } |
@@ -11,3 +11,3 @@ import { Definition } from "../Schema/Definition.js"; | ||
protected childTypeFormatter: TypeFormatter, | ||
protected encodeRefs: boolean | ||
protected encodeRefs: boolean, | ||
) {} | ||
@@ -14,0 +14,0 @@ |
@@ -11,3 +11,3 @@ import { FunctionOptions } from "../Config.js"; | ||
protected childTypeFormatter: TypeFormatter, | ||
protected functions: FunctionOptions | ||
protected functions: FunctionOptions, | ||
) {} | ||
@@ -14,0 +14,0 @@ |
@@ -38,3 +38,3 @@ import { Definition } from "../Schema/Definition.js"; | ||
additionalProperties: false, | ||
}) | ||
}), | ||
); | ||
@@ -50,5 +50,5 @@ } | ||
.getTypes() | ||
.reduce((result: BaseType[], item) => [...result, ...this.childTypeFormatter.getChildren(item)], []) | ||
.reduce((result: BaseType[], item) => [...result, ...this.childTypeFormatter.getChildren(item)], []), | ||
); | ||
} | ||
} |
@@ -42,3 +42,3 @@ import { Definition } from "../Schema/Definition.js"; | ||
(result: BaseType[], baseType) => [...result, ...this.childTypeFormatter.getChildren(baseType)], | ||
[] | ||
[], | ||
); | ||
@@ -69,3 +69,3 @@ | ||
objectProperties = objectProperties.filter( | ||
(property) => !(derefType(property.getType()) instanceof NeverType) | ||
(property) => !(derefType(property.getType()) instanceof NeverType), | ||
); | ||
@@ -72,0 +72,0 @@ } |
@@ -11,3 +11,3 @@ import { Definition } from "../Schema/Definition.js"; | ||
protected childTypeFormatter: TypeFormatter, | ||
protected encodeRefs: boolean | ||
protected encodeRefs: boolean, | ||
) {} | ||
@@ -14,0 +14,0 @@ |
@@ -87,5 +87,5 @@ import { Definition } from "../Schema/Definition.js"; | ||
.filter(notNever) | ||
.reduce((result: BaseType[], item) => [...result, ...this.childTypeFormatter.getChildren(item)], []) | ||
.reduce((result: BaseType[], item) => [...result, ...this.childTypeFormatter.getChildren(item)], []), | ||
); | ||
} | ||
} |
@@ -18,3 +18,3 @@ import { JSONSchema7 } from "json-schema"; | ||
protected childTypeFormatter: TypeFormatter, | ||
private discriminatorType?: DiscriminatorType | ||
private discriminatorType?: DiscriminatorType, | ||
) {} | ||
@@ -45,4 +45,4 @@ | ||
`Cannot find discriminator keyword "${discriminator}" in type ${JSON.stringify( | ||
type.getTypes()[undefinedIndex] | ||
)}.` | ||
type.getTypes()[undefinedIndex], | ||
)}.`, | ||
); | ||
@@ -71,3 +71,3 @@ } | ||
throw new Error( | ||
`Duplicate discriminator values: ${duplicates.join(", ")} in type ${JSON.stringify(type.getName())}.` | ||
`Duplicate discriminator values: ${duplicates.join(", ")} in type ${JSON.stringify(type.getName())}.`, | ||
); | ||
@@ -159,5 +159,5 @@ } | ||
.getTypes() | ||
.reduce((result: BaseType[], item) => [...result, ...this.childTypeFormatter.getChildren(item)], []) | ||
.reduce((result: BaseType[], item) => [...result, ...this.childTypeFormatter.getChildren(item)], []), | ||
); | ||
} | ||
} |
@@ -36,3 +36,3 @@ import { Definition } from "../Schema/Definition.js"; | ||
additionalTypes = additionalTypes.concat( | ||
Array.isArray(prop.type) ? prop.type : [prop.type] | ||
Array.isArray(prop.type) ? prop.type : [prop.type], | ||
); | ||
@@ -45,3 +45,3 @@ } else { | ||
additionalTypes = additionalTypes.concat( | ||
Array.isArray(addProps.type) ? addProps.type : [addProps.type] | ||
Array.isArray(addProps.type) ? addProps.type : [addProps.type], | ||
); | ||
@@ -48,0 +48,0 @@ } else { |
@@ -16,3 +16,3 @@ import { JSONSchema7Definition } from "json-schema"; | ||
a: { [key: string]: JSONSchema7Definition }, | ||
b: { [key: string]: JSONSchema7Definition } | ||
b: { [key: string]: JSONSchema7Definition }, | ||
): { [x: string]: JSONSchema7Definition } { | ||
@@ -19,0 +19,0 @@ const output = { ...structuredClone(a), ...structuredClone(b) }; |
@@ -94,3 +94,3 @@ import { AnyType } from "../Type/AnyType.js"; | ||
inferMap: Map<string, BaseType> = new Map(), | ||
insideTypes: Set<BaseType> = new Set() | ||
insideTypes: Set<BaseType> = new Set(), | ||
): boolean { | ||
@@ -207,3 +207,3 @@ // Dereference source and target | ||
const inCommon = targetMembers.some((targetMember) => | ||
sourceMembers.some((sourceMember) => targetMember.getName() === sourceMember.getName()) | ||
sourceMembers.some((sourceMember) => targetMember.getName() === sourceMember.getName()), | ||
); | ||
@@ -226,3 +226,3 @@ | ||
inferMap, | ||
new Set(insideTypes).add(source).add(target) | ||
new Set(insideTypes).add(source).add(target), | ||
); | ||
@@ -277,3 +277,3 @@ }) | ||
inferMap, | ||
insideTypes | ||
insideTypes, | ||
); | ||
@@ -280,0 +280,0 @@ } |
@@ -23,3 +23,3 @@ import { BaseType } from "../Type/BaseType.js"; | ||
// eslint-disable-next-line no-shadow | ||
predicate: (type: BaseType) => boolean | ||
predicate: (type: BaseType) => boolean, | ||
): BaseType { | ||
@@ -26,0 +26,0 @@ const derefed = derefType(type); |
@@ -10,3 +10,3 @@ import { JSONSchema7Definition } from "json-schema"; | ||
definitions: StringMap<Definition>, | ||
reachable: Set<string> | ||
reachable: Set<string>, | ||
) { | ||
@@ -69,3 +69,3 @@ if (typeof definition === "boolean") { | ||
rootTypeDefinition: Definition | undefined, | ||
definitions: StringMap<Definition> | ||
definitions: StringMap<Definition>, | ||
): StringMap<Definition> { | ||
@@ -72,0 +72,0 @@ if (!rootTypeDefinition) { |
@@ -28,3 +28,3 @@ import { translate } from "../NodeParser/IntersectionNodeParser.js"; | ||
return uniqueLiterals( | ||
type.getTypes().reduce((result: LiteralType[], subType) => [...result, ...getTypeKeys(subType)], []) | ||
type.getTypes().reduce((result: LiteralType[], subType) => [...result, ...getTypeKeys(subType)], []), | ||
); | ||
@@ -43,4 +43,4 @@ } | ||
(result: LiteralType[], parentType) => [...result, ...getTypeKeys(parentType)], | ||
objectProperties | ||
) | ||
objectProperties, | ||
), | ||
); | ||
@@ -47,0 +47,0 @@ } |
@@ -17,3 +17,3 @@ import { Command, Option } from "commander"; | ||
.addOption( | ||
new Option("-e, --expose <expose>", "Type exposing").choices(["all", "none", "export"]).default("export") | ||
new Option("-e, --expose <expose>", "Type exposing").choices(["all", "none", "export"]).default("export"), | ||
) | ||
@@ -23,3 +23,3 @@ .addOption( | ||
.choices(["none", "basic", "extended"]) | ||
.default("extended") | ||
.default("extended"), | ||
) | ||
@@ -29,3 +29,3 @@ .addOption( | ||
jsDoc: "extended", | ||
}) | ||
}), | ||
) | ||
@@ -36,6 +36,6 @@ .addOption( | ||
"How to handle functions. `fail` will throw an error. `comment` will add a comment. `hide` will treat the function like a NeverType or HiddenType." | ||
"How to handle functions. `fail` will throw an error. `comment` will add a comment. `hide` will treat the function like a NeverType or HiddenType.", | ||
) | ||
.choices(["fail", "comment", "hide"]) | ||
.default("comment") | ||
.default("comment"), | ||
) | ||
@@ -53,3 +53,3 @@ .option("--minify", "Minify generated schema", false) | ||
(value: string, list: string[]) => list.concat(value), | ||
[] | ||
[], | ||
) | ||
@@ -56,0 +56,0 @@ .option("--additional-properties", "Allow additional properties for objects with no index signature", false) |
Sorry, the diff of this file is not supported yet
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
804587