Skip to content

fix: treat null CBS metadata fields as empty strings - #3

Merged
thomaspinder merged 1 commit into
mainfrom
fix/null-metadata-fields
Oct 21, 2026
Merged

thomaspinder merged 1 commit into
mainfrom
fix/null-metadata-fields

Conversation

@thomaspinder

Copy link
Copy Markdown
Collaborator

Summary

CBS returns explicit null for missing metadata fields. .get(key, "") only applies its default when the key is absent, so it passed None through and pydantic rejected it. As a result, get_metadata("86103NED") crashed.

 _parse_column(prop)
-  description = prop.get("Description", "")    # None when CBS sends null
+  description = prop.get("Description") or ""

The same change applies to every string field of Column and TableMetadata.

Evidence

  • Before: Client().get_metadata("86103NED") raises ValidationError: description — Input should be a valid string [input_value=None].
    After: it returns 40 properties.
  • New test TestGetMetadata::test_null_fields_become_empty_strings: fails on main with the same ValidationError and passes on this branch.
  • All 54 tests pass. ruff check, ruff format --check and ty check are clean.

Merge Danger

Door: two-way

Blast Radius: small

Only the null-handling changes. A field that used to crash is now "". id falls back to the requested table ID when Identifier is null.

🤖 Generated with Claude Code

CBS sends explicit nulls (e.g. "Description": null in 86103NED), so
.get(key, "") returned None and pydantic rejected it, crashing
get_metadata().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

@thomaspinder
thomaspinder merged commit 741d65e into main Oct 21, 2026
7 checks passed
@thomaspinder
thomaspinder deleted the fix/null-metadata-fields branch October 21, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants