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)