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

[Task] Provide more context in case model validation fails #18

Open
schabdo opened this issue Oct 25, 2023 · 2 comments
Open

[Task] Provide more context in case model validation fails #18

schabdo opened this issue Oct 25, 2023 · 2 comments
Labels
acknowledged Has been viewed by one of the maintainers and is ready for further work, discussion or other steps. enhancement New feature or request

Comments

@schabdo
Copy link

schabdo commented Oct 25, 2023

Given the following model, missing a dataType within characteristic Megabyte:

:Health a samm:Aspect ;
   samm:preferredName "Device Health "@en ;
   samm:description "Health of the Device"@en ;
   samm:properties ( :memory ) ;
   samm:operations ( ) ;
   samm:events ( ) .

:memory a samm:Property ;
   samm:description "Used Memory"@en ;
   samm:characteristic :Memory ;
   samm:exampleValue "5000" .

:Memory a samm-c:Measurement ;
   samm:preferredName "Megabyte"@en ;
   samm:description "Amount of memory"@en ;
   samm-c:unit :megabyte .

:megabyte a unit:Unit ;
   samm:commonCode "MB" ;
   samm:referenceUnit unit:byte ;
   samm:symbol "MB" .

Raises the following error, without any chance to figure out which node actually is affected:

File "/esmf_aspect_meta_model_python/loader/instantiator_base.py", line 77, in get_instance
    new_instance = self._create_instance(element_node)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/esmf_aspect_meta_model_python/loader/instantiator/measurement_instantiator.py", line 28, i
    n _create_instance raise TypeError("Data type can't be None.")
TypeError: Data type can't be None.
@schabdo schabdo added the enhancement New feature or request label Oct 25, 2023
@chris-volk chris-volk added the acknowledged Has been viewed by one of the maintainers and is ready for further work, discussion or other steps. label Oct 31, 2023
@chris-volk
Copy link
Contributor

I guess the first performed step was to load an aspect model?

@chris-volk
Copy link
Contributor

chris-volk commented Oct 31, 2023

For now the easiest solution for you as a user is to valide via SAMM CLI next to working with the Python SDK. An instruction to do that for loading errors shall be implemented as the thrown exception in such cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged Has been viewed by one of the maintainers and is ready for further work, discussion or other steps. enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants