Skip to content

Commit

Permalink
style: 易错代码增加注释
Browse files Browse the repository at this point in the history
  • Loading branch information
Val-istar-Guo committed Sep 27, 2024
1 parent 4b67b6f commit dcdb97a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/sdk/src/utils/format-openapi-document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ import { validateSwagger3 } from './validate-swagger3'
export async function formatOpenapiDocument(document: OpenAPI.Document): Promise<OpenAPIV3.Document> {
// 修复中文和特殊字符串
const swagger = fixSwagger(document)

/**
* NOTE: fixSwagger 需要在 toSwagger3 之前运行
* 因为 toSwagger3 会将部分中文字符替换成随机数字
* 导致 fixSwagger 无法正确修复中文字符
*/

// 将 swagger2 转换为 swagger3
const swagger3 = await toSwagger3(swagger)
// 删除不必要的$ref,避免模板解析出错
Expand Down

0 comments on commit dcdb97a

Please sign in to comment.