Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

openapi-gen-typescript

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openapi-gen-typescript - npm Package Compare versions

Comparing version 0.0.9 to 0.1.0

1

dist/index.d.ts

@@ -18,2 +18,3 @@ import { OpenAPI, OpenAPIV3 } from "openapi-types";

url?: string;
path?: string;
version: string;

@@ -20,0 +21,0 @@ object?: OpenAPI.Document;

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

return __awaiter(this, void 0, void 0, function* () {
const { url, version, object, fetchModuleFile = `${__dirname}/defaultFetch.ts`, outputDir, pascalCase = true, } = options;
const { url, path: filePath, version, object, fetchModuleFile = `${__dirname}/defaultFetch.ts`, outputDir, pascalCase = true, } = options;
const fetchModuleImportCode = `import fetchImpl from '${path.relative(outputDir, fetchModuleFile).replace(/\.ts$/, '')}';\n`;

@@ -95,2 +95,13 @@ let openApiData;

}
else if (filePath) {
if (version === '2') {
const openapi = yield swagger2openapi.convertFile(filePath, {
patch: true,
});
openApiData = openapi.openapi || (yield swaggerParser.dereference(openapi.openapi));
}
else {
openApiData = (yield swaggerParser.parse(filePath));
}
}
else if (!object) {

@@ -97,0 +108,0 @@ throw 'option: url or object must be specified one';

2

package.json
{
"name": "openapi-gen-typescript",
"version": "0.0.9",
"version": "0.1.0",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "types": "dist/index.d.ts",

@@ -97,2 +97,3 @@ // @ts-ignore

url?: string;
path?: string;
version: string;

@@ -109,2 +110,3 @@ object?: OpenAPI.Document;

url,
path: filePath,
version,

@@ -129,2 +131,11 @@ object,

}
} else if (filePath) {
if (version === '2') {
const openapi = await swagger2openapi.convertFile(filePath, {
patch: true,
});
openApiData = openapi.openapi || await swaggerParser.dereference(openapi.openapi);
} else {
openApiData = await swaggerParser.parse(filePath) as OpenAPIV3.Document;
}
} else if (!object) {

@@ -131,0 +142,0 @@ throw 'option: url or object must be specified one'

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