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.10.2 to 0.10.3

__src/baseInterfaces.ts

0

dist/baseInterfaces.d.ts

@@ -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 { IComponents } from '../swaggerInterfaces';

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

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

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

"use strict";
//# sourceMappingURL=consts.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";

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

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

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

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

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

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

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

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

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

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

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

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

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

21

dist/requestCodegen/index.js

@@ -11,4 +11,6 @@ "use strict";

const getRequestBody_1 = require("./getRequestBody");
const getContentType_1 = require("./getContentType");
const mapFormDataToV2_1 = require("./mapFormDataToV2");
function requestCodegen(paths, isV3, options) {
var _a, _b;
var _a, _b, _c, _d;
const requestClasses = {};

@@ -24,5 +26,3 @@ if (!!paths)

}
const contentType = reqProps.consumes && reqProps.consumes.includes('multipart/form-data')
? 'multipart/form-data'
: 'application/json';
const contentType = getContentType_1.getContentType(reqProps, isV3);
let formData = '';

@@ -45,6 +45,9 @@ let pathReplace = '';

};
if (reqProps.parameters) {
const multipartDataProperties = (_b = (_a = reqProps) === null || _a === void 0 ? void 0 : _a.requestBody) === null || _b === void 0 ? void 0 : _b.content['multipart/form-data'];
if (reqProps.parameters || multipartDataProperties) {
// 获取到接口的参数
parsedParameters = getRequestParameters_1.getRequestParameters(reqProps.parameters);
formData = parsedParameters.requestFormData ? 'data = new FormData();\n' + parsedParameters.requestFormData : '';
parsedParameters = getRequestParameters_1.getRequestParameters(reqProps.parameters || mapFormDataToV2_1.mapFormDataToV2(multipartDataProperties.schema));
formData = parsedParameters.requestFormData
? 'data = new FormData();\n' + parsedParameters.requestFormData
: '';
pathReplace = parsedParameters.requestPathReplace;

@@ -57,3 +60,3 @@ }

// 合并imports
if (((_a = parsedRequestBody.imports) === null || _a === void 0 ? void 0 : _a.length) >= 0) {
if (((_c = parsedRequestBody.imports) === null || _c === void 0 ? void 0 : _c.length) >= 0) {
// console.log("requestBody ", parsedRequestBody);

@@ -67,3 +70,3 @@ imports.push(...parsedRequestBody.imports);

parameters =
((_b = parsedParameters.requestParameters) === null || _b === void 0 ? void 0 : _b.length) > 0
((_d = parsedParameters.requestParameters) === null || _d === void 0 ? void 0 : _d.length) > 0
? `params: {

@@ -70,0 +73,0 @@ ${parsedParameters.requestParameters}

@@ -62,6 +62,3 @@ export interface ISwaggerSource {

schema: IParameterSchema;
items: {
type: string;
$ref: string;
};
items: IParameterItems;
type: string;

@@ -114,2 +111,5 @@ format: string;

'format'?: string;
'properties'?: {
[key: string]: IParameterItems;
};
}

@@ -116,0 +116,0 @@ export interface IDictionary<TKey, TValue = any> {

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

@@ -24,3 +24,2 @@ import { IPropDef, ISwaggerOptions } from "./baseInterfaces";

formData: string;
requestBody: any;
}

@@ -27,0 +26,0 @@ /** requestTemplate */

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

${decorators}
'${filedName}'${canNull ? '?' : ''}:${type};
${filedName}${canNull ? '?' : ''}:${type};
`;

@@ -98,3 +98,3 @@ }

function requestTemplate(name, requestSchema, options) {
let { summary = '', parameters = '', responseType = '', method = '', contentType = 'multipart/form-data', path = '', pathReplace = '', parsedParameters = {}, formData = '', requestBody = null, } = requestSchema;
let { summary = '', parameters = '', responseType = '', method = '', contentType = 'multipart/form-data', path = '', pathReplace = '', parsedParameters = {}, formData = '' } = requestSchema;
const { useClassTransformer } = options;

@@ -121,5 +121,3 @@ const { queryParameters = [], bodyParameter = [] } = parsedParameters;

? bodyParameter
: !!requestBody
? 'params.body'
: 'null'}
: 'null'}
${contentType === 'multipart/form-data' ? formData : ''}

@@ -126,0 +124,0 @@ configs.data = data;

export declare function universalGenericTypeDefinition(): string;
export declare function abpGenericTypeDefinition(): string;
import { ISwaggerOptions } from "../baseInterfaces";
export declare function serviceHeader(options: ISwaggerOptions): string;
export declare function customerServiceHeader(options: ISwaggerOptions): string;

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

@@ -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.10.2",
"version": "0.10.3",
"main": "./dist/index",

@@ -41,2 +41,2 @@ "typings": "./dist/",

}
}
}

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