-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Labels
bugSomething isn't workingSomething isn't workingsdkSomething to do with the `sdk` packageSomething to do with the `sdk` package
Description
According to the specification, Referable.display_name should be of type MultiLanguageNameType, and it is also that way in our SDK.
However, if you simply ignore this and write a string, you are still able to write a JSON file, which in turn then is non-compliant. Here's a minimal example:
from basyx.aas import model
from basyx.aas.adapter.json import json_serialization
submodel_1 = model.Submodel(
id_="https://example.org/some_submodel",
submodel_element=[model.Property(
id_short="some_id_short",
value_type=model.datatypes.String,
value="someString",
display_name="Banana", # Wrong Type here!
description=model.MultiLanguageTextType({"en": "An apple"})
)]
)
if __name__ == '__main__':
with open("model.json", "w") as file:
json_serialization.write_aas_json_file(file, model.DictObjectStore([submodel_1]), indent=4)This results in the following model.json:
{
"submodels": [
{
"modelType": "Submodel",
"id": "https://example.org/some_submodel",
"submodelElements": [
{
"idShort": "some_id_short",
"displayName": "Banana",
"description": [
{
"language": "en",
"text": "An apple"
}
],
"modelType": "Property",
"value": "someString",
"valueType": "xs:string"
}
]
}
]
}We should investigate why this happens, where else this type of issue can arise, and what we should do about it.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingsdkSomething to do with the `sdk` packageSomething to do with the `sdk` package