New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

swagger-axios-codegen

Package Overview
Dependencies
Maintainers
1
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swagger-axios-codegen - npm Package Compare versions

Comparing version 0.1.9 to 0.2.0

types/module.d.ts

0

.vscode/settings.json
{
"editor.formatOnSave": true
}

10

dist/definitionCodegen.js

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

const utils_1 = require("./utils");
const camelcase_1 = __importDefault(require("camelcase"));
const pascalcase_1 = __importDefault(require("pascalcase"));
function propTrueType(v, isGenericType) {

@@ -35,4 +35,4 @@ let propType = '';

propType = v.type === 'string' ?
v.enum.map(item => `${item}='${item}'`).join(',') :
v.enum.map(item => `${item}=${item}`).join(',');
v.enum.map(item => `'${item}'='${item}'`).join(',') :
v.enum.map(item => `'${item}'=${item}`).join(',');
}

@@ -61,3 +61,3 @@ // 基本类型

if (isEnum) {
let enumName = `Enum${className}${camelcase_1.default(k, { pascalCase: true })}`;
let enumName = `Enum${className}${pascalcase_1.default(k)}`;
enums.push({

@@ -72,3 +72,3 @@ name: enumName, text: `export enum ${enumName}{

/** ${v.description || ''} */
${k}:${propType};\n
${k}:${propType};\n·
`;

@@ -75,0 +75,0 @@ constructorStr += `this['${k}'] = data['${k}'];\n`;

@@ -89,10 +89,9 @@ "use strict";

}`);
parameters = `params: ${methodParamsName},`;
parameters = `params: ${methodParamsName}={},`;
formData = parsedParameters.requestFormData ? 'data = new FormData();\n' + parsedParameters.requestFormData : '';
pathReplace = parsedParameters.requestPathReplace;
}
let responseType = v.responses['200'] &&
v.responses['200'].schema &&
v.responses['200'].schema.$ref ?
utils_1.refClassName(v.responses['200'].schema.$ref) : 'any';
let responseType = v.responses['200'] && v.responses['200'].schema && v.responses['200'].schema.$ref
? utils_1.refClassName(v.responses['200'].schema.$ref)
: 'any';
// 模版

@@ -117,6 +116,10 @@ RequestMethods[className] += `

${parsedParameters && parsedParameters.queryParameters.length > 0 ? "configs.params = {" + parsedParameters.queryParameters.join(',') + "}" : ''};
${parsedParameters && parsedParameters.queryParameters.length > 0
? 'configs.params = {' + parsedParameters.queryParameters.join(',') + '}'
: ''};
let data = null;
${parsedParameters && parsedParameters.bodyParameters.length > 0 ? "data = {" + parsedParameters.bodyParameters.join(',') + "}" : ''};
${parsedParameters && parsedParameters.bodyParameters.length > 0
? 'data = {' + parsedParameters.bodyParameters.join(',') + '}'
: ''};

@@ -123,0 +126,0 @@ ${contentType === 'multipart/form-data' ? formData : ''}

{
"name": "swagger-axios-codegen",
"version": "0.1.9",
"version": "0.2.0",
"main": "./dist/index",

@@ -21,2 +21,3 @@ "typings": "./dist/",

"camelcase": "^5.0.0",
"pascalcase": "^0.1.1",
"prettier": "^1.12.1"

@@ -28,4 +29,4 @@ },

"@types/prettier": "^1.12.2",
"typescript": "^2.8.1"
"typescript": "^2.8.3"
}
}
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