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.5.6 to 0.5.7

4

CHANGELOG.md
## 0.5.7
Fix Response type [issue 26](https://github.com/Manweill/swagger-axios-codegen/issues/26)
## 0.5.5

@@ -3,0 +7,0 @@

@@ -0,0 +0,0 @@ export interface ISwaggerOptions {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=baseInterfaces.js.map

@@ -0,0 +0,0 @@ import { IDefinitionProperties } from "../swaggerInterfaces";

@@ -0,0 +0,0 @@ import { IEnumDef } from "../baseInterfaces";

@@ -0,0 +0,0 @@ import { IDefinitions } from '../swaggerInterfaces';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { IDefinitionProperty } from "../swaggerInterfaces";

@@ -0,0 +0,0 @@ "use strict";

import { ISwaggerOptions } from './baseInterfaces';
export declare function codegen(params: ISwaggerOptions): Promise<void>;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { IParameter } from '../swaggerInterfaces';

2

dist/requestCodegen/getRequestParameters.js

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

requestFormData += `if(params['${paramName}']){
data.append('${paramName}',<any>params['${paramName}'])
data.append('${paramName}',params['${paramName}'] as any)
}\n

@@ -56,0 +56,0 @@ `;

@@ -0,0 +0,0 @@ import { IRequestMethod } from "../swaggerInterfaces";

@@ -9,24 +9,28 @@ "use strict";

// It does not allow the schema defined directly, but only the primitive type is allowed.
let result;
let result = 'any';
let isRef = false;
if (!reqProps.responses['200'] || !reqProps.responses['200'].schema) {
result = 'any';
}
else if (reqProps.responses['200'].schema.$ref) {
result = utils_1.refClassName(reqProps.responses['200'].schema.$ref);
isRef = true;
}
else {
let checkType = reqProps.responses[200].schema.type;
if (!checkType) {
// implicit types
if (reqProps.responses[200].schema.items) {
result = 'array';
}
else { // if (reqProps.responses[200].schema.properties) // actual check
result = 'object';
}
// 提取Schema
const resSchema = reqProps.responses['200'] && reqProps.responses['200'].schema
? reqProps.responses['200'].schema
: null;
if (resSchema) {
let checkType = resSchema.type;
console.log('checkType', checkType);
// 如果是数组
if (checkType === 'array' || resSchema.items) {
const refType = resSchema.items.$ref
? utils_1.refClassName(resSchema.items.$ref) || 'any'
: utils_1.toBaseType(resSchema.type);
console.log('reftype', refType);
result = refType + '[]';
console.log('1', result);
}
else if (resSchema.items) {
result = utils_1.refClassName(resSchema.items.$ref) || 'any';
console.log('1', result);
}
else {
result = checkType; // string? -> string
result = checkType;
result = utils_1.toBaseType(result);
console.log('1', result);
}

@@ -39,5 +43,4 @@ if (result == 'object') {

}
result = utils_1.toBaseType(result);
// else ... JSON primitive types (string, boolean, number)
}
console.log('after', result);
return { responseType: result, isRef };

@@ -44,0 +47,0 @@ }

@@ -0,0 +0,0 @@ import { IPaths } from '../swaggerInterfaces';

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

${parsedParameters.requestParameters}
} = <any>{},`
} = {} as any,`
: '';

@@ -44,0 +44,0 @@ formData = parsedParameters.requestFormData ? 'data = new FormData();\n' + parsedParameters.requestFormData : '';

@@ -0,0 +0,0 @@ export interface ISwaggerSource {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -0,0 +0,0 @@ export interface ISwaggerSource {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=swaggerInterfaces.js.map

@@ -0,0 +0,0 @@ import { IPropDef } from "./baseInterfaces";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { IDefinitionClass, IDefinitionEnum } from "./baseInterfaces";

@@ -0,0 +0,0 @@ "use strict";

{
"name": "swagger-axios-codegen",
"version": "0.5.6",
"version": "0.5.7",
"main": "./dist/index",

@@ -27,3 +27,3 @@ "typings": "./dist/",

"dependencies": {
"axios": "^0.18.0",
"axios": "^0.19.0",
"camelcase": "^5.0.0",

@@ -37,4 +37,4 @@ "pascalcase": "^0.1.1",

"tslint": "^5.10.0",
"typescript": "^3.2.2"
"typescript": "^3.5.3"
}
}

@@ -7,2 +7,3 @@ # swagger-axios-codegen

[![Build Status](https://dev.azure.com/manweill/swagger-axios-codegen/_apis/build/status/Manweill.swagger-axios-codegen?branchName=master)](https://dev.azure.com/manweill/swagger-axios-codegen/_build/latest?definitionId=1&branchName=master)
[![open issues](https://img.shields.io/github/issues-raw/manweill/swagger-axios-codegen.svg)](https://img.shields.io/github/issues-raw/manweill/swagger-axios-codegen.svg)

@@ -9,0 +10,0 @@ require node > v8.0.0

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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