-
Notifications
You must be signed in to change notification settings - Fork 144
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
Plugin: Cannot add required fields for StepData
#2766
Comments
Yeah, this is not supported by The solution might be switching to |
With either the attrs validator or json schema validations, it would work, but you would still have to specify it as
Yeah, but this one would still break the error reporting. I am actually stuck at the next issue with the JSON schema validation:
But the JSON schema validation is not performed for
After you first introduced me to this, I can confirm |
Yeah, but that's the difference: "with attrs..." - and the rest does not matter. It's not possible with stdlib
Hmm, that would be unexpected. Once the class is successfully defined, existing code should be able to work with it easily,
Right, I wanted to address this one but missed it eventually. No, tmt does not have a way to include custom schema, but it should have, e.g. an environment variable similar to
It is performed every time tmt loads fmf data. tmt asks fmf library to load data from files, then asks fmf library to run schema validation, then tmt turns the tree of fmf structures into tests and plans. The report from JSON validation is just a warning, I plan to improve its reporting - until then, it can be way too cryptic to be of any use as a mandatory test.
Hard to tell, maybe check |
I think I am thinking of the schema validation error that I currently have. I will come back to this if the issue persists with using
Ok, I can than move on and see what I can hack up further.
Yep, that's the plan I had in mind. First figure out if we will have any surprises with EPEL + Fedora rawhide compatibility :D |
I was trying to do
I would like this to be a single-value required field, but I cannot do that because it follows non-required fields of
PrepareStepData
Approach 1
Add
kw_only=True
This kinda works, but the error handling is all messed up:
Potential solution to this is to
try ... catch
this source of error and re-format it appropriatelyApproach 2
Add
attrs
stylevalidator
. The most intuitive for the user using it, but requires quite some implementation on the backend. This would still have such reporting errors, but this is easier totry ... catch
and report the errorsApproach 3
Wrap the
dataclass
decorator with json schema validation. I think this is the preferred approach that is planned to be implemented?One missing part here, is how can the plugin add paths for the schema to check? Ideally this is something to specify when subclassing a plugin or plugin data class
The text was updated successfully, but these errors were encountered: