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

adapter: Refactor XML and JSON de-/serialization methods #165

Closed
wants to merge 13 commits into from

Conversation

zrgt
Copy link
Contributor

@zrgt zrgt commented Nov 15, 2023

The methods for handling attributes of abstract classes seemed to me too big.

In this PR these methods are refactored. Mostly a method extraction refactoring was done, to simplify the methods and to keep less abstraction levels in a single method

The function _expect_type was renamed to _is_of_type as it represents clearer what the func does.

This PR is not relevant for the V3.0 release and can be merged later

s-heppner and others added 13 commits November 14, 2023 15:58
This commit remanes `valueDataType_t` from the XSD to
`valueDataType`.
Furthermore, it adds a missing `<reference>` tag around
the `refersTo` References of `Extension`.
The current order of the elements in `SubmodelElementList`
was wrong. This updates the order.
Version 3.0 of the spec removes the attribute `kind` from
`SubmodelElement`s.
While we already implemented this, it was still missing in the
XSD Schema, as well as the examples. This commit fixes that.
Currently, the XML deserialization missed the
`<aas:refersTo>` wrapper around the single references
inside `Extension.refers_to`. This commit fixes that.
Currently, `Extension.refers_to` is declared as a `Iterable[Reference]`.
This implies, that we can not necessarily check, whether or not the
attribute is empty or not.
This creates a problem with the XML serialization, since the
`<aas.refersTo>` element should only appear if there is at least
one `Reference` inside.

This commit changes the `Extension.refers_to` to be a list of
`Reference`s, as well as adapting a more clear check whether
or not the attribute is empty in `adapter.xml.xml_serialization`.
@zrgt zrgt closed this Nov 15, 2023
@zrgt zrgt deleted the improve/refactoring branch November 15, 2023 18:33
@s-heppner s-heppner added the v3.0 label Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants