fix(models): accept null for optional string fields #41
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/project-list-null-deserialize"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
yt project listwas failing on any YouTrack instance that has a project with a missing description (or a user with no email on file, etc.):YouTrack returns
"description": nullrather than omitting the field, and plain#[serde(default)]only handles the missing-field path, not the explicit-null path.Fix
Adds a
null_or_missing_to_defaulthelper that wrapsOption::<T>::deserialize(...).map(Option::unwrap_or_default). Applied to the string fields most likely to be null on the wire:Project::name,Project::description, every string onUser, andBundleValue::name/description. The missing-field path keeps working because the helper still respects#[serde(default)].Verified
yt project listagainst the affected instance now renders the full table instead of erroring. The PMC project (the one with the null description) appears with an empty description cell.Test plan
cargo fmt --allcargo clippy --all-targets --all-features -- --deny warningscargo test --all-targets(218 passed; was 215)./target/release/yt project listagainst the previously-failing instance renders correctly