Skip to content

Commit eb44e8a

Browse files
committed
change according to xmlization removal for registry and discovery classes
1 parent 7c8fbe2 commit eb44e8a

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

server/app/api_utils/http_api_helpers.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@
1919

2020
from basyx.aas import model
2121

22-
from basyx.aas.adapter.xml import XMLConstructables
22+
from basyx.aas.adapter.xml import XMLConstructables, read_aas_xml_element
2323

2424
from server.app import server_model
25-
from server.app.adapter.xmlization import ServerXMLConstructables, read_server_aas_xml_element
2625
from server.app.adapter.jsonization import ServerStrictAASFromJsonDecoder, ServerStrictStrippedAASFromJsonDecoder
2726

2827
from typing import Callable, List, Optional, Type, TypeVar, Union
@@ -67,15 +66,16 @@ class HTTPApiDecoder:
6766
model.Submodel: XMLConstructables.SUBMODEL,
6867
model.SubmodelElement: XMLConstructables.SUBMODEL_ELEMENT,
6968
model.Reference: XMLConstructables.REFERENCE,
70-
71-
server_model.AssetAdministrationShellDescriptor: ServerXMLConstructables.ASSET_ADMINISTRATION_SHELL_DESCRIPTOR,
72-
server_model.SubmodelDescriptor: ServerXMLConstructables.SUBMODEL_DESCRIPTOR,
73-
server_model.AssetLink: ServerXMLConstructables.ASSET_LINK,
7469
}
7570

7671
@classmethod
7772
def check_type_support(cls, type_: type):
78-
if type_ not in cls.type_constructables_map:
73+
tolerated_types = (
74+
server_model.AssetAdministrationShellDescriptor,
75+
server_model.SubmodelDescriptor,
76+
server_model.AssetLink,
77+
)
78+
if type_ not in cls.type_constructables_map and type_ not in tolerated_types:
7979
raise TypeError(f"Parsing {type_} is not supported!")
8080

8181
@classmethod
@@ -146,7 +146,7 @@ def xml(cls, data: bytes, expect_type: Type[T], stripped: bool) -> T:
146146
cls.check_type_support(expect_type)
147147
try:
148148
xml_data = io.BytesIO(data)
149-
rv = read_server_aas_xml_element(xml_data, cls.type_constructables_map[expect_type],
149+
rv = read_aas_xml_element(xml_data, cls.type_constructables_map[expect_type],
150150
stripped=stripped, failsafe=False)
151151
except (KeyError, ValueError) as e:
152152
# xml deserialization creates an error chain. since we only return one error, return the root cause

0 commit comments

Comments
 (0)