Repository navigation
refactor(desktop): generate Rust models from OpenAPI #2113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
AlexStocks
merged 8 commits into
oceanbase:master
from
CX33071:refactor/desktop-openapi-generator
Oct 21, 2026
+2,958
−327
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7c3177d
refactor(desktop): generate Rust models from OpenAPI
CX33071 991b955
fix(desktop): support Windows OpenAPI generation
CX33071 43c6120
fix(desktop): support Windows OpenAPI generation
CX33071 d46395e
fix(desktop): update generated IPC types
CX33071 32ced08
fix(desktop): export generated IPC model declarations
CX33071 08b78d4
fix(desktop): accept nullable pagination cursor
CX33071 6f5d507
docs(desktop):document Java generation prerequisites
CX33071 e7ce9f3
Merge upstream master into desktop generator branch
CX33071 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", | ||
| "spaces": 2, | ||
| "generator-cli": { | ||
| "version": "7.26.0" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P2] 新增的生成链前置(PATH 上的
java、首次运行下载 JAR)未写入两份 README 的构建前置本 PR 把
generate:check的代价从纯 Node 计算变成「启动 JVM + 可能下载 JAR + 调用 rustfmt」,但desktop/README.md第 20 行的前置清单与README.zh.md对应位置仍只有 VS C++ Build Tools、Node 24.14.1、pnpm 11.13.1、Rust 1.95.0、WebView2。证据链:
desktop/scripts/generate.mjs第 194 行是顶层const rustModels = await generateRustModels();,--check分支在第 226 行才开始比对字节 ⇒generate:check同样执行生成器,不是只读校验。generateRustModels()内先pnpm exec openapi-generator-cli generate ...,再run("rustfmt", ["--edition", "2024", wirePath])。desktop/package.json的lint与build都串了generate:check;CI 日志(job118638863265)可对照:第 460 行$ oxlint ui scripts && pnpm generate:check && ...,第 527 行$ pnpm generate:check && tsc --noEmit && vite build。即pnpm lint/pnpm build两个常规命令都依赖该链路。openapi-generator-cliwill download the appropriate JAR file and invoke thejavaexecutable to run the OpenAPI Generator. You must have thejavabinary executable available on yourPATHfor this to work. (JDK 11 is the minimal version supported.)」(openapitools/openapi-generator-cli)windows-2025runner 的 PATH 已预装C:/hostedtoolcache/windows/Java_Temurin-Hotspot_jdk/17.0.20-101/x64/bin(同一 job 日志的环境 PATH 行),仓库未声明这一前置。JAR 在首次运行时从 Maven Central/Sonatype 拉取,无哈希校验,openapitools.json只固定版本串。影响:缺 JDK 或无法访问 Maven 的贡献者执行
pnpm --dir desktop lint/build会在generate:check阶段失败,而 README 的构建前置不会指向原因。建议:在
desktop/README.md的前置段落与其README.zh.md对应段落同时补上 JDK 11+ 与「首次generate需访问 Maven Central」;若希望离线可复现,在openapitools.json里加storageDir或说明预置 JAR 的位置。无需改动产品运行时行为。There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in the latest update.
Both desktop/README.md and desktop/README.zh.md now document:
I also verified the updated setup with pnpm install --frozen-lockfile, pnpm generate:check, and pnpm typecheck.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
确认已在 head
e7ce9f38修复,两份文档均已落实且语义一致。改动核实(提交
6f5d5074,desktop/README.md +3/-1、desktop/README.zh.md +3/-1):README.md第 20 行前置清单已含JDK 11 or newer with `java` available on `PATH`;README.zh.md第 20 行为「JDK 11 或更高版本(确保java位于PATH中)」,与英文版逐项对应。generate/generate:check启动基于 Java 的 OpenAPI Generator,首次运行可能从 Maven Central 下载固定版本 JAR、因此首次生成或漂移检查需网络,后续可复用。英文用may download、中文用「可能……下载」,措辞与「已有缓存时不下载」的实际行为一致,未过度声明。openapitools.json固定的 Generator 7.26.0 准确:上游 README 写明Java 11 runtime at a minimum,安装前置列* [Java 11];openapitools.json的version为7.26.0,未随本次合并漂移。声称的验证已由 CI 独立证实(
Desktop validation / windows,run39590150278,job119188793670,head_sha=e7ce9f38,conclusionsuccess):pnpm install --frozen-lockfile通过(说明 merge 解决的pnpm-lock.yaml冲突与package.json自洽)pnpm lint输出$ node scripts/generate.mjs --check→Desktop contract matches OpenAPI.pnpm typecheck(tsc --noEmit)、pnpm test(vitest)、pnpm build(含generate:check+tsc+vite build)、cargo fmt --check、cargo clippy --all-targets -- -D warnings、cargo test、pnpm ipc:check全部通过,且pnpm tauri build --bundles nsis完成一处可选改进,不阻塞合并:
desktop/.mise.toml目前只 pin 了node与pnpm,未包含 java。用 mise 的贡献者仍需自行装 JDK,mise无法一键就绪。若希望与「Node/pnpm 版本由 .mise.toml 固定」的原则对齐,可考虑加一行 Java(例如java = "temurin-21"),同时保持 README 的 11+ 下限不变。该线程可以关闭。