Skip to content

Fix deserialization problem with new type aliases#9

Merged
memowe merged 4 commits intomainfrom
fix/typealias_serialization
Mar 26, 2026
Merged

Fix deserialization problem with new type aliases#9
memowe merged 4 commits intomainfrom
fix/typealias_serialization

Conversation

@memowe
Copy link
Copy Markdown
Member

@memowe memowe commented Mar 26, 2026

See #8 for details. Closes #8.

@memowe memowe self-assigned this Mar 26, 2026
@memowe memowe requested a review from Copilot March 26, 2026 14:05
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a dataclasses_json deserialization TypeError triggered by PEP 695 type aliases (typing.TypeAliasType) by switching ID-related annotations away from the new type ID = str form, and adds regression tests to cover the affected serialization roundtrips.

Changes:

  • Replace ID (PEP 695 type alias) usages in pygexml.page dataclasses with plain str annotations for IDs and dict keys.
  • Add serialization roundtrip tests for TextLine, TextRegion, and Page.
  • Update tests to stop importing/using ID and type those parameters as str.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pygexml/page.py Removes PEP 695 ID alias usage by annotating IDs/dict keys as str, addressing dataclasses_json deserialization failures.
test/test_page.py Adds regression tests for to_dict()/from_dict() roundtrips and updates imports/type hints to match the new str ID annotations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pygexml/page.py
@memowe memowe merged commit 0b5a6cc into main Mar 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Deserialization of TextRegion and Page throws TypeError

2 participants