-
Notifications
You must be signed in to change notification settings - Fork 129
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
Add link config validation #3339
base: main
Are you sure you want to change the base?
Conversation
6534397
to
0d85ebd
Compare
Nice! What do you think about this settings for BaseModel? |
0d85ebd
to
c49656d
Compare
Since Pydantic v2 supports backward compatibility with v1 through
It may be a good idea to add that. I didn't encounter any problems without it, but it may be needed in some scenarios. Added in 9481860 |
58905c0
to
9481860
Compare
tmt/config/models/__init__.py
Outdated
from tmt._compat.pydantic import BaseModel, Extra | ||
|
||
|
||
def create_alias(name: str) -> str: |
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.
Looks like key_to_option
, https://github.com/teemtee/tmt/blob/main/tmt/utils/__init__.py#L2926, can we re-use the existing function?
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.
Replaced in 15aa64a.
9481860
to
15aa64a
Compare
15aa64a
to
b3be792
Compare
b3be792
to
e7ef3ff
Compare
As this is a new approach, it would be good to get a few more reviews. Moving to 1.40. |
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.
LGTM:)
I followed the extended test ,and put the following ~/.config/link.fmf:
Then run tmt link command, got no warning, I guess we could warn users by printing the str(error.cause), |
This PR extracts the
Config
class fromtmt.utils
into its own file and also introduces config validation using Pydantic models. Currently, validation is applied only to the link configuration.Resolves #84.
Pull Request Checklist