-
Notifications
You must be signed in to change notification settings - Fork 12
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
Enh/schema validation attribute values #830
Conversation
Merge release 3.8.0
for more information, see https://pre-commit.ci
…imphony/simphony-osp into enh/schema-validation-attribute-values
@kysrpex , there seems to be some problem with the sqlite-wrapper in the pipeline. I am not sure if this is related to the native |
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.
Hi @MBueschelberger,
I requested two very minor changes that you can automatically apply just clicking a button on GitHub, if you do it then the PR is good to go.
I am not very happy with the code (and foresee bugs) but this is strongly related to the fact that I am not happy with the original code either. I know that you are just plugging your feature into it and it seems reasonable to me, and the changes do not make things worse. Let's say that I would not be ready to document and promote the whole schema validation feature in its current state (neither was I ready before), but I think this PR is a net positive anyway.
Co-authored-by: José Manuel Domínguez <43052541+kysrpex@users.noreply.github.com>
Co-authored-by: José Manuel Domínguez <43052541+kysrpex@users.noreply.github.com>
Why does the pipeline fail again after you merged dev into this branch at commit |
Good question honestly, I will try to find out. |
closes #828
New functionalities for checking the value and length (if it is string) or range (it is a float/int/bool) of a CUDS-attribute.
Please see the updated unittests as reference for this example:
In the case of a string for an attribute, we can state what should be the length of a
city.name
. For all other types, we can specify the numerical range.Here is an example of how to restrict a cuds with respect to a certain value, which is very useful for unittesting:
Furthermore, the schema validation received an extra keyword-argument called
strict_check
which - as the name already says - triggers a strict check of the cuds during the validation. This basically means that the test fails when any extra cuds apart the ones listed in the schema-file are encountered while querying the root object.Please note: This implementation is closely imitating what is supposed to be covered by any standardized markup-language such as
SHACL
. But due to lack of time in the use case, we could not really focus on integrating these languages intosimphony-osp
, because the effort for translating the schema file into the required shapes was too high.