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.2.7 to 0.3.0

12

dist/index.js

@@ -307,6 +307,6 @@ "use strict";

const generateClassArr = exportArr.map(exp => {
return exp
.replace(/ interface | type = /g, ' class ')
.replace(/ type ([^=]+) = components.([a-zA-Z.]+)[;{}]?/g, ' class $1 extends $2 {}')
.replace(/ type ([^=]+) = {/g, ' class $1 {');
const exp1 = exp.replace(/ interface | type = /g, ' class ');
const exp2 = exp1.replace(/ type ([^=]+) = components.([a-zA-Z._]+)[;{}]?/g, ' class $1 extends $2 {}');
const exp3 = exp2.replace(/ type ([^=]+) = {/g, ' class $1 {');
return exp3;
});

@@ -340,3 +340,5 @@ pathsMap[namespaceName] = {

.relative(currTagNameDir, fetchModuleFile)
.replace(/\.ts$/, '')}';`,
.replace(/\.ts$/, '')}';`
.split(path.sep)
.join('/'),
schemasClassCode.length > 0 ? `import * as schemas from '../schemas';\n` : '\n',

@@ -343,0 +345,0 @@ code,

{
"name": "openapi-gen-typescript",
"version": "0.2.7",
"version": "0.3.0",
"main": "dist/index.js",

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

# openapi-gen-typescript
Generate typescript code for openapi.

@@ -8,5 +9,5 @@

gen({
url: 'https://petstore.swagger.io/v2/swagger.json',
version: "2",
outputDir: `${__dirname}/gen`
url: 'https://petstore.swagger.io/v2/swagger.json',
version: '2',
outputDir: `${__dirname}/gen`,
});

@@ -21,2 +22,3 @@ ```

| path | The filePath of fetch openapi or swagger data |
| object | The docs of fetch openapi or swagger data |
| version | The version of Swagger or OpenApi, example: `2`, `3` |

@@ -26,3 +28,1 @@ | outputDir | Dir of output files |

| handlePostScript | post script to customize the result |

@@ -439,6 +439,9 @@ // @ts-ignore

const generateClassArr = exportArr.map(exp => {
return exp
.replace(/ interface | type = /g, ' class ')
.replace(/ type ([^=]+) = components.([a-zA-Z.]+)[;{}]?/g, ' class $1 extends $2 {}')
.replace(/ type ([^=]+) = {/g, ' class $1 {');
const exp1 = exp.replace(/ interface | type = /g, ' class ');
const exp2 = exp1.replace(
/ type ([^=]+) = components.([a-zA-Z._]+)[;{}]?/g,
' class $1 extends $2 {}',
);
const exp3 = exp2.replace(/ type ([^=]+) = {/g, ' class $1 {');
return exp3;
});

@@ -479,3 +482,5 @@ pathsMap[namespaceName] = {

.relative(currTagNameDir, fetchModuleFile)
.replace(/\.ts$/, '')}';`,
.replace(/\.ts$/, '')}';`
.split(path.sep)
.join('/'),
schemasClassCode.length > 0 ? `import * as schemas from '../schemas';\n` : '\n',

@@ -482,0 +487,0 @@ code,

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