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.0 to 0.2.1

20

dist/index.js

@@ -35,2 +35,3 @@ "use strict";

const constants_1 = require("./constants");
const axios_1 = require("axios");
function getCamelcase(urlPath, options) {

@@ -112,6 +113,19 @@ return camelcase(urlPath.split('/').join('_'), options);

const { dereference, parse } = swaggerParser;
const params = url || filePath;
let params = url || filePath;
if (version === '2') {
const { convertUrl, convertFile } = swagger2openapi;
const openapiConvert = url ? convertUrl : convertFile;
// convertUrl响应速度很慢,改为使用convertObj
const { convertObj, convertFile } = swagger2openapi;
const openapiConvert = url ? convertObj : convertFile;
if (url) {
try {
const result = yield axios_1.default.get(url);
if (result.status !== 200) {
throw Error(`未返回正确的status code ${result.status}: ${url}`);
}
params = result.data;
}
catch (e) {
console.error('e :>> ', e.message);
}
}
const openapi = yield openapiConvert(params, {

@@ -118,0 +132,0 @@ patch: true,

2

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

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

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

import RequestBodyObject = OpenAPIV3.RequestBodyObject;
import Axios from 'axios';

@@ -171,6 +172,18 @@ type ContentObject = {

const { dereference, parse } = swaggerParser;
const params: any = url || filePath;
let params: any = url || filePath;
if (version === '2') {
const { convertUrl, convertFile } = swagger2openapi;
const openapiConvert = url ? convertUrl : convertFile;
// convertUrl响应速度很慢,改为使用convertObj
const { convertObj, convertFile } = swagger2openapi;
const openapiConvert = url ? convertObj : convertFile;
if (url) {
try {
const result = await Axios.get(url);
if (result.status !== 200) {
throw Error(`未返回正确的status code ${result.status}: ${url}`);
}
params = result.data;
} catch (e) {
console.error('e :>> ', e.message);
}
}
const openapi = await openapiConvert(params, {

@@ -177,0 +190,0 @@ patch: true,

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