Add schema generation - #14
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces first-class schema generation so datasets containing extension tags stored as URIs can be serialized by automatically adding the necessary HEAD.SCHMA.TAG declarations, and updates related formatting documentation.
Changes:
- Add
gedcom7.generate_schema(records)to declare missing URI-tag abbreviations inHEAD.SCHMA. - Add a comprehensive serializer test suite covering schema generation behavior (idempotence, collision avoidance, placement, corpus parity).
- Refresh docstrings in
gedcom7.formatto clarify payload vs omitted-structure behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/test_serializer.py | Adds new test coverage for schema generation and round-tripping of URI-tag abbreviations. |
| gedcom7/serializer.py | Implements schema generation and extension-tag invention logic used to support dumps with URI tags. |
| gedcom7/format.py | Clarifies documentation for format_value/set_value behavior around empty payloads vs omitted structures. |
| gedcom7/init.py | Exposes generate_schema as a package-level API. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (1)
gedcom7/format.py:36
- The docstring examples use identifiers (Date, DATE, NO_DATE, ADOP) that aren’t defined in this module and also don’t reflect the actual
type_idvalues accepted byformat_value(it expects the GEDCOM terms URI keys used inconst.payloads). This makes the examples misleading for users of the API.
format_value(Date(year=2000), DATE) -> "2000"
format_value(DatePeriod(), NO_DATE) -> "" write an empty payload
format_value(False, ADOP) -> None write no structure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.