🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@cerios/openapi-to-typescript

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cerios/openapi-to-typescript - npm Package Compare versions

Comparing version
1.0.1
to
1.1.0
+32
-8
dist/cli.js

@@ -244,2 +244,7 @@ #!/usr/bin/env node

}
const showWarnings = options.showWarnings !== false;
this.warningCollector = new import_openapi_core3.WarningCollector({
packageName: "@cerios/openapi-to-typescript",
enabled: showWarnings
});
this.options = {

@@ -258,3 +263,6 @@ input: options.input,

showStats: (_e = options.showStats) != null ? _e : true,
batchSize: (_f = options.batchSize) != null ? _f : 10
showWarnings,
batchSize: (_f = options.batchSize) != null ? _f : 10,
includeHeader: options.includeHeader,
fileHeader: options.fileHeader
};

@@ -874,3 +882,3 @@ this.spec = (0, import_openapi_core3.loadOpenAPISpec)(this.options.input);

generateString() {
var _a;
var _a, _b, _c;
if ((_a = this.spec.components) == null ? void 0 : _a.schemas) {

@@ -895,9 +903,22 @@ for (const [name, schema] of Object.entries(this.spec.components.schemas)) {

this.generateInlineResponseTypes();
(0, import_openapi_core3.validateFilters)(this.filterStats, this.options.operationFilters);
(0, import_openapi_core3.validateFilters)(this.filterStats, this.options.operationFilters, (msg) => {
this.warningCollector.add(msg);
});
const orderedSchemaNames = this.topologicalSort();
const output = [
"// Auto-generated by @cerios/openapi-to-typescript",
"// Do not edit this file manually",
""
];
const output = [];
const customHeader = (0, import_openapi_core3.generateCustomFileHeader)(this.options.fileHeader);
if (customHeader) {
output.push(customHeader.trimEnd());
output.push("");
}
if (this.options.includeHeader !== false) {
output.push(
(0, import_openapi_core3.generateFileHeader)({
packageName: "@cerios/openapi-to-typescript",
apiTitle: (_b = this.spec.info) == null ? void 0 : _b.title,
apiVersion: (_c = this.spec.info) == null ? void 0 : _c.version
}).trimEnd()
);
output.push("");
}
if (this.options.showStats === true) {

@@ -928,2 +949,3 @@ output.push(...this.generateStats());

}
this.warningCollector.flush();
return output.join("\n");

@@ -955,2 +977,3 @@ }

console.log(` \u2713 Generated ${normalizedOutput}`);
this.warningCollector.flush();
}

@@ -1019,2 +1042,3 @@ };

batchSize: defaults.batchSize,
fileHeader: defaults.fileHeader,
// Override with spec-specific values (including required input/output)

@@ -1021,0 +1045,0 @@ ...spec

@@ -163,2 +163,4 @@ #!/usr/bin/env node

formatFilterStatistics,
generateCustomFileHeader,
generateFileHeader,
generateHeaderParamsTypeName,

@@ -178,3 +180,4 @@ generateInlineRequestTypeName,

topologicalSortSchemas,
validateFilters
validateFilters,
WarningCollector
} from "@cerios/openapi-core";

@@ -274,2 +277,7 @@ function stripSchemaPrefix(name, prefixes) {

}
const showWarnings = options.showWarnings !== false;
this.warningCollector = new WarningCollector({
packageName: "@cerios/openapi-to-typescript",
enabled: showWarnings
});
this.options = {

@@ -288,3 +296,6 @@ input: options.input,

showStats: (_e = options.showStats) != null ? _e : true,
batchSize: (_f = options.batchSize) != null ? _f : 10
showWarnings,
batchSize: (_f = options.batchSize) != null ? _f : 10,
includeHeader: options.includeHeader,
fileHeader: options.fileHeader
};

@@ -904,3 +915,3 @@ this.spec = loadOpenAPISpec(this.options.input);

generateString() {
var _a;
var _a, _b, _c;
if ((_a = this.spec.components) == null ? void 0 : _a.schemas) {

@@ -925,9 +936,22 @@ for (const [name, schema] of Object.entries(this.spec.components.schemas)) {

this.generateInlineResponseTypes();
validateFilters(this.filterStats, this.options.operationFilters);
validateFilters(this.filterStats, this.options.operationFilters, (msg) => {
this.warningCollector.add(msg);
});
const orderedSchemaNames = this.topologicalSort();
const output = [
"// Auto-generated by @cerios/openapi-to-typescript",
"// Do not edit this file manually",
""
];
const output = [];
const customHeader = generateCustomFileHeader(this.options.fileHeader);
if (customHeader) {
output.push(customHeader.trimEnd());
output.push("");
}
if (this.options.includeHeader !== false) {
output.push(
generateFileHeader({
packageName: "@cerios/openapi-to-typescript",
apiTitle: (_b = this.spec.info) == null ? void 0 : _b.title,
apiVersion: (_c = this.spec.info) == null ? void 0 : _c.version
}).trimEnd()
);
output.push("");
}
if (this.options.showStats === true) {

@@ -958,2 +982,3 @@ output.push(...this.generateStats());

}
this.warningCollector.flush();
return output.join("\n");

@@ -985,2 +1010,3 @@ }

console.log(` \u2713 Generated ${normalizedOutput}`);
this.warningCollector.flush();
}

@@ -1019,2 +1045,3 @@ };

batchSize: defaults.batchSize,
fileHeader: defaults.fileHeader,
// Override with spec-specific values (including required input/output)

@@ -1021,0 +1048,0 @@ ...spec

+20
-2

@@ -31,2 +31,14 @@ import { OperationFilters, BaseGeneratorOptions, RequireExcept } from '@cerios/openapi-core';

/**
* Internal options that extend public options with internal-only properties
* @internal
*/
interface InternalTypeScriptGeneratorOptions extends TypeScriptGeneratorOptions {
/**
* Whether to include the auto-generated header comment in output
* Used internally by downstream packages for consistent branding
* @internal
*/
includeHeader?: boolean;
}
/**
* Resolved options with defaults applied

@@ -54,3 +66,8 @@ */

showStats?: boolean;
showWarnings?: boolean;
batchSize?: number;
/**
* Custom comment lines to add at the very top of generated files
*/
fileHeader?: string[];
}

@@ -146,3 +163,4 @@ /**

private filterStats;
constructor(options: TypeScriptGeneratorOptions);
private readonly warningCollector;
constructor(options: TypeScriptGeneratorOptions | InternalTypeScriptGeneratorOptions);
/**

@@ -335,2 +353,2 @@ * Validate the OpenAPI specification

export { type ConfigFile, type DefaultOptions, type EnumFormat, type EnumGeneratorOptions, type EnumGeneratorResult, type ExecutionMode, type ResolvedOptions, type SpecOptions, type TypeGeneratorOptions, type TypeGeneratorResult, TypeScriptDefaultsSchema, TypeScriptGenerator, type TypeScriptGeneratorOptions, TypeScriptGeneratorOptionsSchema, TypeScriptSpecificOptionsSchema, defineConfig, formatTypeProperty, generateEnum, generateTypeDeclaration, loadConfig, mergeCliWithConfig, mergeConfigWithDefaults };
export { type ConfigFile, type DefaultOptions, type EnumFormat, type EnumGeneratorOptions, type EnumGeneratorResult, type ExecutionMode, type InternalTypeScriptGeneratorOptions, type ResolvedOptions, type SpecOptions, type TypeGeneratorOptions, type TypeGeneratorResult, TypeScriptDefaultsSchema, TypeScriptGenerator, type TypeScriptGeneratorOptions, TypeScriptGeneratorOptionsSchema, TypeScriptSpecificOptionsSchema, defineConfig, formatTypeProperty, generateEnum, generateTypeDeclaration, loadConfig, mergeCliWithConfig, mergeConfigWithDefaults };

@@ -31,2 +31,14 @@ import { OperationFilters, BaseGeneratorOptions, RequireExcept } from '@cerios/openapi-core';

/**
* Internal options that extend public options with internal-only properties
* @internal
*/
interface InternalTypeScriptGeneratorOptions extends TypeScriptGeneratorOptions {
/**
* Whether to include the auto-generated header comment in output
* Used internally by downstream packages for consistent branding
* @internal
*/
includeHeader?: boolean;
}
/**
* Resolved options with defaults applied

@@ -54,3 +66,8 @@ */

showStats?: boolean;
showWarnings?: boolean;
batchSize?: number;
/**
* Custom comment lines to add at the very top of generated files
*/
fileHeader?: string[];
}

@@ -146,3 +163,4 @@ /**

private filterStats;
constructor(options: TypeScriptGeneratorOptions);
private readonly warningCollector;
constructor(options: TypeScriptGeneratorOptions | InternalTypeScriptGeneratorOptions);
/**

@@ -335,2 +353,2 @@ * Validate the OpenAPI specification

export { type ConfigFile, type DefaultOptions, type EnumFormat, type EnumGeneratorOptions, type EnumGeneratorResult, type ExecutionMode, type ResolvedOptions, type SpecOptions, type TypeGeneratorOptions, type TypeGeneratorResult, TypeScriptDefaultsSchema, TypeScriptGenerator, type TypeScriptGeneratorOptions, TypeScriptGeneratorOptionsSchema, TypeScriptSpecificOptionsSchema, defineConfig, formatTypeProperty, generateEnum, generateTypeDeclaration, loadConfig, mergeCliWithConfig, mergeConfigWithDefaults };
export { type ConfigFile, type DefaultOptions, type EnumFormat, type EnumGeneratorOptions, type EnumGeneratorResult, type ExecutionMode, type InternalTypeScriptGeneratorOptions, type ResolvedOptions, type SpecOptions, type TypeGeneratorOptions, type TypeGeneratorResult, TypeScriptDefaultsSchema, TypeScriptGenerator, type TypeScriptGeneratorOptions, TypeScriptGeneratorOptionsSchema, TypeScriptSpecificOptionsSchema, defineConfig, formatTypeProperty, generateEnum, generateTypeDeclaration, loadConfig, mergeCliWithConfig, mergeConfigWithDefaults };

@@ -263,2 +263,7 @@ "use strict";

}
const showWarnings = options.showWarnings !== false;
this.warningCollector = new import_openapi_core3.WarningCollector({
packageName: "@cerios/openapi-to-typescript",
enabled: showWarnings
});
this.options = {

@@ -277,3 +282,6 @@ input: options.input,

showStats: (_e = options.showStats) != null ? _e : true,
batchSize: (_f = options.batchSize) != null ? _f : 10
showWarnings,
batchSize: (_f = options.batchSize) != null ? _f : 10,
includeHeader: options.includeHeader,
fileHeader: options.fileHeader
};

@@ -893,3 +901,3 @@ this.spec = (0, import_openapi_core3.loadOpenAPISpec)(this.options.input);

generateString() {
var _a;
var _a, _b, _c;
if ((_a = this.spec.components) == null ? void 0 : _a.schemas) {

@@ -914,9 +922,22 @@ for (const [name, schema] of Object.entries(this.spec.components.schemas)) {

this.generateInlineResponseTypes();
(0, import_openapi_core3.validateFilters)(this.filterStats, this.options.operationFilters);
(0, import_openapi_core3.validateFilters)(this.filterStats, this.options.operationFilters, (msg) => {
this.warningCollector.add(msg);
});
const orderedSchemaNames = this.topologicalSort();
const output = [
"// Auto-generated by @cerios/openapi-to-typescript",
"// Do not edit this file manually",
""
];
const output = [];
const customHeader = (0, import_openapi_core3.generateCustomFileHeader)(this.options.fileHeader);
if (customHeader) {
output.push(customHeader.trimEnd());
output.push("");
}
if (this.options.includeHeader !== false) {
output.push(
(0, import_openapi_core3.generateFileHeader)({
packageName: "@cerios/openapi-to-typescript",
apiTitle: (_b = this.spec.info) == null ? void 0 : _b.title,
apiVersion: (_c = this.spec.info) == null ? void 0 : _c.version
}).trimEnd()
);
output.push("");
}
if (this.options.showStats === true) {

@@ -947,2 +968,3 @@ output.push(...this.generateStats());

}
this.warningCollector.flush();
return output.join("\n");

@@ -974,2 +996,3 @@ }

console.log(` \u2713 Generated ${normalizedOutput}`);
this.warningCollector.flush();
}

@@ -1038,2 +1061,3 @@ };

batchSize: defaults.batchSize,
fileHeader: defaults.fileHeader,
// Override with spec-specific values (including required input/output)

@@ -1040,0 +1064,0 @@ ...spec

@@ -152,2 +152,4 @@ // src/index.ts

formatFilterStatistics,
generateCustomFileHeader,
generateFileHeader,
generateHeaderParamsTypeName,

@@ -167,3 +169,4 @@ generateInlineRequestTypeName,

topologicalSortSchemas,
validateFilters
validateFilters,
WarningCollector
} from "@cerios/openapi-core";

@@ -256,2 +259,7 @@ function stripSchemaPrefix(name, prefixes) {

}
const showWarnings = options.showWarnings !== false;
this.warningCollector = new WarningCollector({
packageName: "@cerios/openapi-to-typescript",
enabled: showWarnings
});
this.options = {

@@ -270,3 +278,6 @@ input: options.input,

showStats: (_e = options.showStats) != null ? _e : true,
batchSize: (_f = options.batchSize) != null ? _f : 10
showWarnings,
batchSize: (_f = options.batchSize) != null ? _f : 10,
includeHeader: options.includeHeader,
fileHeader: options.fileHeader
};

@@ -886,3 +897,3 @@ this.spec = loadOpenAPISpec(this.options.input);

generateString() {
var _a;
var _a, _b, _c;
if ((_a = this.spec.components) == null ? void 0 : _a.schemas) {

@@ -907,9 +918,22 @@ for (const [name, schema] of Object.entries(this.spec.components.schemas)) {

this.generateInlineResponseTypes();
validateFilters(this.filterStats, this.options.operationFilters);
validateFilters(this.filterStats, this.options.operationFilters, (msg) => {
this.warningCollector.add(msg);
});
const orderedSchemaNames = this.topologicalSort();
const output = [
"// Auto-generated by @cerios/openapi-to-typescript",
"// Do not edit this file manually",
""
];
const output = [];
const customHeader = generateCustomFileHeader(this.options.fileHeader);
if (customHeader) {
output.push(customHeader.trimEnd());
output.push("");
}
if (this.options.includeHeader !== false) {
output.push(
generateFileHeader({
packageName: "@cerios/openapi-to-typescript",
apiTitle: (_b = this.spec.info) == null ? void 0 : _b.title,
apiVersion: (_c = this.spec.info) == null ? void 0 : _c.version
}).trimEnd()
);
output.push("");
}
if (this.options.showStats === true) {

@@ -940,2 +964,3 @@ output.push(...this.generateStats());

}
this.warningCollector.flush();
return output.join("\n");

@@ -967,2 +992,3 @@ }

console.log(` \u2713 Generated ${normalizedOutput}`);
this.warningCollector.flush();
}

@@ -1037,2 +1063,3 @@ };

batchSize: defaults.batchSize,
fileHeader: defaults.fileHeader,
// Override with spec-specific values (including required input/output)

@@ -1039,0 +1066,0 @@ ...spec

{
"name": "@cerios/openapi-to-typescript",
"version": "1.0.1",
"version": "1.1.0",
"description": "Generate TypeScript types from OpenAPI specifications",

@@ -60,3 +60,3 @@ "keywords": [

"zod": "^4.3.6",
"@cerios/openapi-core": "1.0.1"
"@cerios/openapi-core": "1.1.0"
},

@@ -63,0 +63,0 @@ "devDependencies": {

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

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

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

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