-
Notifications
You must be signed in to change notification settings - Fork 6
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
Port to pydantic 2 #192
Merged
Merged
Port to pydantic 2 #192
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
6df13ed
Progress porting to pydantic 2
1420646
isort
0ba9802
Tests over BaseRTU
e89d8c4
Test over File.construct_url
e63bbaf
Test over User.construct_auth_type.
56efd78
Test over Space.construct_url()
5b13527
Test project.construct_url
93fdd56
Notebook model unit tests.
e14498e
isort
ae96905
Remove unused import
ef8707d
Another round of dependency updates
cf2d481
Test suite passing without warnings
8474af4
lint
58cd581
Remove bump-pydantic, no longer needed
533c8b1
Merge branch 'main' into upgrade_pydantic
e0502d1
Better changelog
d85d35a
Merge remote-tracking branch 'origin/main' into upgrade_pydantic
c4e9aa8
Merge changelog
0d87526
Merge branch 'main' into upgrade_pydantic
fa69c5d
Move to new changelog section
2576e1c
clean up DeltaCallback class (not Pydantic anymore)
1c28928
Merge branch 'main' into upgrade_pydantic
bfaf6ee
Merge branch 'main' into upgrade_pydantic
fab8b64
Merge branch 'main' into upgrade_pydantic
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
import os | ||
from typing import Optional | ||
|
||
from pydantic import validator | ||
from pydantic import model_validator | ||
|
||
from origami.models.api.base import ResourceBase | ||
|
||
|
||
class Space(ResourceBase): | ||
name: str | ||
description: Optional[str] | ||
description: Optional[str] = None | ||
url: Optional[str] = None | ||
|
||
@validator("url", always=True) | ||
def construct_url(cls, v, values): | ||
@model_validator(mode="after") | ||
def construct_url(self): | ||
noteable_url = os.environ.get("PUBLIC_NOTEABLE_URL", "https://app.noteable.io") | ||
return f"{noteable_url}/s/{values['id']}" | ||
self.url = f"{noteable_url}/s/{self.id}" | ||
|
||
return self |
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
Don't make the logging call that includes dumping the model if our current logging level is lower than DEBUG.