From 956ac43376fe8403e74930da0197299a5b876f71 Mon Sep 17 00:00:00 2001 From: Manweill Date: Fri, 19 Jan 2024 23:17:25 +0800 Subject: [PATCH] fix format --- src/componentsCodegen/propTrueType.ts | 2 +- src/definitionCodegen/propTrueType.ts | 4 ++-- src/requestCodegen/getRequestParameters.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/componentsCodegen/propTrueType.ts b/src/componentsCodegen/propTrueType.ts index d468a38..bf80ab2 100644 --- a/src/componentsCodegen/propTrueType.ts +++ b/src/componentsCodegen/propTrueType.ts @@ -78,7 +78,7 @@ export function propTrueType(v: IDefinitionProperty): { } // 基本类型 else { - result.propType = toBaseType(v.type, v.items.format) + result.propType = toBaseType(v.type, v.items?.format) } return result } diff --git a/src/definitionCodegen/propTrueType.ts b/src/definitionCodegen/propTrueType.ts index 0829efd..38288cb 100644 --- a/src/definitionCodegen/propTrueType.ts +++ b/src/definitionCodegen/propTrueType.ts @@ -31,7 +31,7 @@ export function propTrueType(v: IDefinitionProperty): { const currentResult = propTrueType(v.items) result = { ...result, ...currentResult } } else { - result.propType = toBaseType(v.items.type) + '[]' + result.propType = toBaseType(v.items.type, v.items?.format) + '[]' } } result.isArray = true @@ -52,7 +52,7 @@ export function propTrueType(v: IDefinitionProperty): { } // 基本类型 else { - result.propType = toBaseType(v.type) + result.propType = toBaseType(v.type, v?.format) } return result } diff --git a/src/requestCodegen/getRequestParameters.ts b/src/requestCodegen/getRequestParameters.ts index 9d23779..e6afc25 100644 --- a/src/requestCodegen/getRequestParameters.ts +++ b/src/requestCodegen/getRequestParameters.ts @@ -65,7 +65,7 @@ export function getRequestParameters(params: IParameter[], useHeaderParameters: } // 基本类型 else { - propType = toBaseType(p.type, p.format) + propType = toBaseType(p.type, p?.format) } const paramName = camelcase(p.name)