Closed neko1990 closed 3 months ago
当前 typescript-json 的代码中 bean 的 resolve 函数有很多空行,因为每个 field 都会来上一行,无论是否需要resolve。 这个 commit 在生成前判断一下是否为空,不为空再生成对应resolve。可能 scriban 有更优雅的解决方案,但大体搂了一眼没找到。 apply 后 luban_example 中对应的 schema.ts 文件由 5144 行减少到 4853 行。
消除空行的必要性不是很高。其他语言生成时也有这个问题,除非你把其他语言的生成代码也一并优化了
当前 typescript-json 的代码中 bean 的 resolve 函数有很多空行,因为每个 field 都会来上一行,无论是否需要resolve。 这个 commit 在生成前判断一下是否为空,不为空再生成对应resolve。可能 scriban 有更优雅的解决方案,但大体搂了一眼没找到。 apply 后 luban_example 中对应的 schema.ts 文件由 5144 行减少到 4853 行。