Skip to content
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

Assignment of incorrect data type does not raise warning/error #317

Open
hassec opened this issue Jul 31, 2024 · 4 comments
Open

Assignment of incorrect data type does not raise warning/error #317

hassec opened this issue Jul 31, 2024 · 4 comments

Comments

@hassec
Copy link
Contributor

hassec commented Jul 31, 2024

Simple reproducer with omas 0.94:

import omas
ods = omas.ODS()
ods["summary.global_quantities.r0.value"] = "potato"
print(ods)

This will not raise any errors. The schema says this should be a FLT_0D and I assumed that OMAS would raise an error, similarly to how it does when dimensions or path names are incorrect.

Schema:

 "summary.global_quantities.r0.value": {
  "data_type": "FLT_0D",
  "documentation": "Value",
  "full_path": "summary/global_quantities/r0/value",
  "lifecycle_status": "active",
  "type": "constant",
  "units": "m"
 },

Does OMAS not assert that the assigned data type matches the schema?

@orso82
Copy link
Member

orso82 commented Aug 1, 2024

@hassec take a look at the consistency_checker() function. It looks like it doesn't do much when a string is inserted

def consistency_checker(location, value, info, consistency_check, imas_version):

Would you be willing to draft a fix, and open a PR? Thanks.

@hassec
Copy link
Contributor Author

hassec commented Aug 1, 2024

@orso82 Thanks for the pointer. I'll try to find some time to investigate this, but it will have to wait until I have some more idle time.

Copy link

github-actions bot commented Oct 1, 2024

This issue has not seen any activity in the past 60 days. It is now marked as stale and will be closed in 7 days if no further activity is registered.

@hassec
Copy link
Contributor Author

hassec commented Oct 1, 2024

@orso82 would you mind adding the enhancement label to this issue to avoid it going stale? (I don't have the rights to do so)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants