Skip to content

Commit

Permalink
fix: 修复类型错误并更新文档 (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
werheng authored May 4, 2024
1 parent 59e5c05 commit e875f3d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ npm run openapi
| 属性 | 类型 | 说明 |
| -------------- | ---- | ------------------ |
| afterOpenApiDataInited | (openAPIData: OpenAPIObject) => OpenAPIObject | - |
| customFunctionName | (data: OperationObject) => string | 自定义请求方法路径 |
| customTypeName | (data: OperationObject) => string | 自定义函数名称 |
| customClassName | (tagName: string) => string | 自定义类型名称 |
| customFunctionName | (data: APIDataType) => string | 自定义请求方法函数名称 |
| customTypeName | (data: APIDataType) => string | 自定义类型名称 |
| customClassName | (tagName: string) => string | 自定义类名 |
| customType | (<br>schemaObject: SchemaObject \| undefined,<br>namespace: string,<br>originGetType:(schemaObject: SchemaObject \| undefined, namespace: string) => string,<br>) => string | 自定义获取类型 <br> *返回非字符串将使用默认方法获取type* |
| customFileNames | (<br>operationObject: OperationObject,<br>apiPath: string,<br>_apiMethod: string,<br>) => string[] | 自定义生成文件名,可返回多个,表示生成多个文件. <br> *返回为空,则使用默认的获取方法获取* |
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import converter from 'swagger2openapi';
import Log from './log';
import { mockGenerator } from './mockGenerator';
import { ServiceGenerator } from './serviceGenerator';
import type { APIDataType } from './serviceGenerator';

const getImportStatement = (requestLibPath: string) => {
if (requestLibPath && requestLibPath.startsWith('import')) {
Expand Down Expand Up @@ -53,9 +54,9 @@ export type GenerateServiceProps = {
afterOpenApiDataInited?: (openAPIData: OpenAPIObject) => OpenAPIObject;

/** 自定义函数名称 */
customFunctionName?: (data: OperationObject) => string;
customFunctionName?: (data: APIDataType) => string;
/** 自定义类型名称 */
customTypeName?: (data: OperationObject) => string;
customTypeName?: (data: APIDataType) => string;
/** 自定义 options 默认值 */
customOptionsDefaultValue?: (data: OperationObject) => Record<string, any> | undefined;
/** 自定义类名 */
Expand Down

0 comments on commit e875f3d

Please sign in to comment.