refactor: migrate raw HTTP to typed SDK handles#141
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
| eprintln!("error parsing response: {e}"); | ||
| std::process::exit(1); | ||
| } | ||
| let result = CreateResponse { |
There was a problem hiding this comment.
super nit: with this change CreateResponse is only constructed here and rendered via the manual json!/serde_yaml blocks below — it's no longer deserialized from a response body or serialized directly. The #[derive(Deserialize, Serialize)] on the struct (line 302) are now dead and can be dropped. (not blocking)
There was a problem hiding this comment.
Clean refactor. Error handling via e.exit() reproduces the old api_error formatting (plus the 4xx re-auth hint), the Option<Option<_>> flattening is correct, and the SDK's required default_catalog is reflected in the updated mocks. One super-nit left inline.
| /// from the SDK's `DatabaseDetailResponse` (see the `From` impl), keeping the | ||
| /// `-o json`/`-o yaml` contract independent of the generated model's field order | ||
| /// and `Option<Option<_>>` nullability. | ||
| #[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] |
There was a problem hiding this comment.
super nit: same as the CreateResponse note in connections.rs — after this migration Database (and likewise DatabaseSummary at line 12, DatabaseAttachment at line 39) are only ever built via their From<hotdata::models::…> impls and serialized for -o json/-o yaml output; nothing deserializes them anymore. The Deserialize in their derives is now dead and can be dropped (keep Serialize). CreateDatabaseResponse is unaffected — it's still deserialized on the delete+recreate raw path. (not blocking)
There was a problem hiding this comment.
Clean, well-documented migration to the typed SDK handles. Verified the raw paths that intentionally stay (delete+recreate inspecting error bodies, CreateDatabaseResponse deserialization), the From impl flattening of Option<Option<_>> fields, and the discovery_status.to_string() lowercase convention (consistent with connections_new.rs). Test fixtures correctly updated with content-type headers and the now-required default_catalog field. Prior super-nits on dead Deserialize derives are addressed.
Closes #131. Migrates the clean database and connection call sites from the seam's raw
get_json/post_raw/delete_rawhelpers to the SDK's typed resource handles; the lossy/closed-enum/raw-body-inspection sites stay raw as documented.