octocrab を 0.49 に上げる#24
Conversation
Follow-up to the route-string migration. Replace reqwest-based dependencies with url + http direct deps, adapt to renamed and newtyped models, and convert enum fields to strings where the CSV output expected them. Notable adjustments: - reqwest dep dropped; url + http added as direct dependencies - Octocrab::absolute_url() removed in favor of passing route strings to Octocrab::get(), already done in the previous PR - models::User renamed to Author, id fields are now newtypes (UserId / IssueId / LabelId / WorkflowId / JobId / RunId / CommentId) - Issue::state, Job::status and Step::status are now enums; they are serialized to snake_case strings via a small helper - Issue::author_association is Option<AuthorAssociation>; record type updated accordingly - Step::started_at is now Option<DateTime>; JobStepRec follows - Job::check_run_url is now String, not Url
|
#23 では
そのため、GHES の ただ、この PR で octocrab 0.49 に上がることで前提が変わっています。0.49.7 の
このため、 一方で、octocrab 0.49 の
なので、#23 の #25 は |
octocrab 0.49 passes the `route` argument to `http::Uri::from_str`
before the BaseUriLayer gets a chance to combine it with base_uri.
Path-only URIs must start with a slash per the http crate, so
without a leading slash the call fails with
`Error::Uri { source: InvalidUri { kind: InvalidFormat } }`
before reaching the network.
The BaseUriLayer preserves the base URI's path when joining, so
leading-slash routes like `/repos/...` work correctly against
GHES base URIs of the form `https://.../api/v3/` as well.
|
@n01e0
整理いただいたとおり、 #23 (octocrab 0.8.13) は |
|
ありがとうございまsu! |
Summary
octocrab 0.8.13 から 0.49.x へのバージョンアップです。前段の #23 のマージ後に適用することを想定しています。
Changes
依存関係
reqwestへの直接依存を削除しました。octocrab が内部で reqwest を使わなくなり、reqwest::Urlを介して型を共有する必要がなくなったためですurlを features = ["serde"] で直接依存に追加しましたhttp1 系を直接依存に追加しました (Page::nextがOption<http::Uri>型になったため)コード
models::Userがmodels::Authorに改名されたため、各 fetcher の import をAuthor as Userでエイリアスしたり、直接Authorに切り替えたりして追従しましたUserId,IssueId,LabelId,CommentId,WorkflowId,JobId,RunIdなどの id フィールドがpub struct XxxId(pub u64)の newtype になったため、from.id.0 as i64のような形で既存レコードの i64 型との間を取り持っていますIssue::stateがIssueStateenum、Issue::author_associationがOption<AuthorAssociation>に変更されたので、IssueRec側もそれぞれ型を差し替えましたJob::status/Step::statusがworkflows::Statusenum、Job::conclusion/Step::conclusionがOption<Conclusion>enum に変更されたので、CSV 出力の snake_case 文字列を維持するためenum_to_stringヘルパ経由で変換していますStep::started_atがOption<DateTime>に変更されたので、JobStepRec::started_atも Option 化しましたJob::check_run_urlがUrlからStringに変更されたので、JobRec::check_run_urlとJobStepRec::check_run_urlもStringにしましたOctocrabBuilder::base_url(&Url)がbase_uri(impl TryInto<Uri>)に改名されたので、src/main.rsの呼び出しを差し替えましたReview points
Cargo.lockの差分が大きいですが、hyper / rustls / tokio など依存グラフが大きく変わるためですsrc/issues.rs::test_convert_issue_model) が無改修で通過することを確認しましたContext
octx に GitHub App installation token 認証を追加する準備として、3 本に分割した PR のうちの 2 本目です。3 本目で App 認証を追加します。
本 PR では
Cargo.tomlの version は上げません。3 本マージ完了後にまとめて bump する想定です。