czh-api 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,28 @@
2
2
 
3
3
  所有重要的版本更新都会记录在此文件中。
4
4
 
5
+ ## [1.0.6] - 2026-04-14
6
+
7
+ ### 修复
8
+ - 修复部分模块在 schema 编译阶段因嵌套字段 `title` 含中文标点、空值或数字开头而生成非法类型别名的问题(如 `export type = ...`、`export type 12 = ...`)。
9
+ - 修复 `expert/groups`、`expert/customers` 等模块在同步解析时出现 `Declaration or statement expected` / `'{` expected` 报错的问题。
10
+
11
+ ### 改进
12
+ - 在类型编译前新增 schema 预处理:递归移除嵌套 schema 的 `title`,仅保留顶层 schema 名称作为类型名来源,避免无效标识符影响 `json-schema-to-typescript` 生成结果。
13
+
14
+ ## [1.0.5] - 2026-03-19
15
+
16
+ ### 修复
17
+ - 修复 FastAPI 场景下返回类型字段被错误降级为 `any` 的问题(如 `items.$ref`、`anyOf`、`oneOf`、`allOf` 组合场景)。
18
+ - 修复数组响应与嵌套对象类型在 fallback 生成流程中丢失字段的问题,避免出现仅有 `{ [key: string]: any }` 的空壳接口。
19
+ - 修复 `group_ids` 等多层结构类型解析不完整的问题,支持递归解析到更深层级(如 `number[] | null`)。
20
+ - 修复类型增强阶段对复杂类型名(数组、联合类型)处理不稳定导致的类型声明异常问题。
21
+
22
+ ### 改进
23
+ - 增强 fallback 类型生成策略:优先基于 `module.schemas` 还原字段结构,再回退到 `any`,生成结果更可用。
24
+ - 增强类型依赖收集能力:从字段类型表达式中提取嵌套引用类型并自动补齐声明。
25
+ - 完善 README 模板示例并与当前默认模板保持一致(`api.hbs`、`index.hbs`、`types.hbs`)。
26
+
5
27
  ## [1.0.4] - 2026-03-19
6
28
 
7
29
  ### 修复
package/README.md CHANGED
@@ -190,12 +190,7 @@ export const {{functionName}} = ({{#if hasParams}}params: {{requestParamsTypeNam
190
190
  return http.request<{{responseTypeName}}>({
191
191
  url: `{{path}}`,
192
192
  method: '{{method}}',
193
- {{#if hasParams}}
194
- params,
195
- {{/if}}
196
- {{#if hasData}}
197
- data,
198
- {{/if}}
193
+ {{#if hasParams}}{{#unless (eq method 'put')}}{{#unless (eq method 'post')}}params,{{/unless}}{{/unless}}{{/if}}{{#if hasData}}data,{{/if}}
199
194
  {{#if contentType}}
200
195
  headers: { 'Content-Type': '{{contentType}}' },
201
196
  {{/if}}
@@ -209,11 +204,9 @@ export const {{functionName}} = ({{#if hasParams}}params: {{requestParamsTypeNam
209
204
  export const {{functionName}} = ({{#if hasParams}}params: {{requestParamsTypeName}}{{/if}}{{#if hasData}}{{#if hasParams}}, {{/if}}data: {{requestBodyTypeName}}{{/if}}) => {
210
205
  return request.{{#if (eq method "delete")}}del{{else}}{{method}}{{/if}}<{{responseTypeName}}>({
211
206
  url: `{{path}}`,
212
- {{#if hasParams}}
213
- params,
214
- {{/if}}
215
- {{#if hasData}}
216
- data,
207
+ {{#if hasParams}}{{#unless (eq method 'put')}}{{#unless (eq method 'post')}}params,{{/unless}}{{/unless}}{{/if}}{{#if hasData}}data,{{/if}}
208
+ {{#if contentType}}
209
+ headers: { 'Content-Type': '{{contentType}}' },
217
210
  {{/if}}
218
211
  });
219
212
  };