Skip to content

Title: Fix serialization validation errors and enum metadata nullability - #67

Merged
dschwartznyc merged 5 commits into
mainfrom
fix/serialize-validation-errors
Nov 10, 2026
Merged

dschwartznyc merged 5 commits into
mainfrom
fix/serialize-validation-errors

Conversation

@plamen-neykov

@plamen-neykov plamen-neykov commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

This PR fixes validation error handling, optional enum metadata, and enum serialization compatibility with newer Pydantic releases.

  • Preserve the original ConditionViolationError or ValidationError when rune_serialize() fails before root metadata is created.
  • Accept None for optional enums with metadata while rejecting it for non-nullable fields. Serialize null values according to the requested dump options.
  • Fix enum serialization on Pydantic 2.14.3 by calling handler(value) without forwarding SerializationInfo into its index_key argument. The minimum supported Pydantic version remains 2.10.3.
    It also addresses Ruff, Pylint, and Pylance warnings through import cleanup, updated typing, module-level logging, formatting, and simpler exception handling. Unsupported input types passed to rune_deserialize() now raise TypeError instead of ValueError.

Regression coverage includes invalid choices, preservation of validation exceptions, validation options, optional enum defaults, null serialization, and enum metadata round-trips.

Validation on Pydantic 2.14.3: 399 passed, 19 skipped across the tracked test suite.

Fixes #56 and #57.

plamen-neykov and others added 2 commits November 3, 2026 21:48
Allow cleanup when root metadata has not been created, preserving
ConditionViolationError and ValidationError.

Add regression coverage for invalid choices and validation options.
…sis warnings

Use WrapValidator to accept None for optional enums while rejecting it
for non-nullable fields. Skip enum metadata serialization for None.

Add regression coverage for validation, serialization, and metadata
round-trips.

Address Ruff, Pylint, and Pylance warnings across the runtime, cached JSON
deserializer, and tests. Clean up imports, typing, logging, formatting,
and exception handling. Raise TypeError for unsupported rune_deserialize
input types.

Fixes #57
@plamen-neykov plamen-neykov self-assigned this Nov 10, 2026
@plamen-neykov plamen-neykov added the bug Something isn't working label Nov 10, 2026
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Test Results

443 tests  +44   423 ✅ +44   1s ⏱️ ±0s
  1 suites ± 0    20 💤 ± 0 
  1 files   ± 0     0 ❌ ± 0 

Results for commit e50a9b8. ± Comparison against base commit f305cf9.

♻️ This comment has been updated with latest results.

@plamen-neykov
plamen-neykov marked this pull request as draft November 10, 2026 19:27
Call the enum serialization handler with only the enum value instead
of passing SerializationInfo as the index_key argument. Remove the
unused info parameter from the wrap serializer callback.

Fix serialization failures on Pydantic 2.14.3 while preserving
compatibility with the existing minimum supported version.
@plamen-neykov
plamen-neykov marked this pull request as ready for review November 10, 2026 20:33

@dschwartznyc dschwartznyc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@dschwartznyc
dschwartznyc merged commit 263677c into main Nov 10, 2026
6 checks passed
@dschwartznyc
dschwartznyc deleted the fix/serialize-validation-errors branch November 10, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rune_serialize raises KeyError instead of ConditionViolationError for an invalid choice

2 participants