-
Notifications
You must be signed in to change notification settings - Fork 0
Use pydantic models to represent minecraft-data #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ItsDrike
wants to merge
4
commits into
main
Choose a base branch
from
use-pydantic-models
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Open
ItsDrike
added a commit
that referenced
this pull request
Aug 8, 2025
ItsDrike
added a commit
that referenced
this pull request
Aug 8, 2025
c8bcc22
to
083198e
Compare
ItsDrike
added a commit
that referenced
this pull request
Aug 10, 2025
083198e
to
8c73200
Compare
ItsDrike
added a commit
that referenced
this pull request
Aug 10, 2025
f289469
to
d9c0205
Compare
ItsDrike
added a commit
that referenced
this pull request
Aug 10, 2025
d9c0205
to
3268792
Compare
ItsDrike
added a commit
that referenced
this pull request
Aug 10, 2025
3268792
to
2c87df9
Compare
2c87df9
to
e043fcd
Compare
0d3251b
to
132947d
Compare
192b859
to
22797b0
Compare
22797b0
to
6cd586b
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
a: api
Related to core public API of the project
m: breaking
This introduces backwards compatibility breaking changes to the public API
p: 1 - high
Blocks other tasks / Important bug
s: stale
Has had no activity for a while (might get closed for inactivity/marked up for grabs soon)
t: feature
New request or feature
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.
Addresses: #6
This PR moves away from using simple
dict
objects in favor of custom typed pydantic V2 models. This provides us with validation that the individual instances each follow the expected structure (which was designed based on the JSON schemas), and allows users to rely on the auto-completion features of their editor to get the data they're interested in.This also remaps all camelCase fields to snake_case to follow idiomatic python conventions.
Warning
This is a breaking change, since:
load_common_data
now returns a customCommonData
object, instead of adict
.load_version
now returns a customVersionData
object, instead of adict
.The custom objects are not backwards compatible with
dict
(No__getitem__
support, camelCase fields were converted to snake_case)This PR also introduces 2 new runtime dependencies:
pydantic
(for the model classes with automated conversion from a dict and field validations)eval_type_backport
(to allow using modern type annotations with pydantic fields)