-
Notifications
You must be signed in to change notification settings - Fork 17
chore!: Update model parsing to use Pydantic V2 instead of Pydantic V1 #164
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
Conversation
|
🎉 |
7095f8a to
31b3b77
Compare
|
And the follow-up, it doesn't seem like it's breaking, but because it's such an overhaul underneath we're going to go with a minor version bump? I think I can get behind that. |
You mean in OpenJobDescription/openjd-cli#134, right? It seemed reasonable to err that way in an abundance of caution, yes. |
Signed-off-by: Mark Wiebe <399551+mwiebe@users.noreply.github.com>
|
epmog
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is exciting - Ship it!


What was the problem/requirement? (What/Why)
The RFC 0002 proposal https://github.com/OpenJobDescription/openjd-specifications/blob/mainline/rfcs/0002-model-extensions.md
depends on parsing differently based on the contents of the "extensions" field at the root of the document.
Pydantic V1 doesn't provide a way to carry a context to all the validators, while Pydantic V2 does.
What was the solution? (How)
Update job and environment parsing to use Pydantic V2.
What is the impact of this change?
We will be able to implement the extensions RFC. Pydantic V2 is a nice upgrade over Pydantic V1, so
further work in this library can benefit from upstream improvements.
How was this change tested?
Yes, have run all the tests. In some cases, I found that Pydantic V2 has more strict behavior than V1,
and I updated the tests to accommodate. While I mostly preserved the error message formatting, I
made some small tweaks to the messages being validated in the tests.
Was this change documented?
Yes, I updated the explainer documentation that included Pydantic V1 details to reflect V2.
Is this a breaking change?
While largely compatible, the underlying implementation uses Pydantic V2 models instead of Pydantic V1
models, and they have incompatible interfaces. Usage of this library that depends on those internal details
will need to be updated.
Does this change impact security?
This change doesn't impact security. Updating to Pydantic V2 will help the library to maintain up-to-date
dependencies.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.