chore!: Update model parsing to use Pydantic V2 instead of Pydantic V1#164
Merged
mwiebe merged 1 commit intoOpenJobDescription:mainlinefrom Feb 11, 2025
Merged
chore!: Update model parsing to use Pydantic V2 instead of Pydantic V1#164mwiebe merged 1 commit intoOpenJobDescription:mainlinefrom
mwiebe merged 1 commit intoOpenJobDescription:mainlinefrom
Conversation
|
🎉 |
7095f8a to
31b3b77
Compare
crowecawcaw
previously approved these changes
Feb 10, 2025
epmog
reviewed
Feb 10, 2025
Contributor
|
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. |
Contributor
Author
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
approved these changes
Feb 11, 2025
Contributor
epmog
left a comment
There was a problem hiding this comment.
This is exciting - Ship it!
crowecawcaw
approved these changes
Feb 11, 2025
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.


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.