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

ValueOnly serialization in json #29

Open
matgnt opened this issue Apr 22, 2024 · 3 comments
Open

ValueOnly serialization in json #29

matgnt opened this issue Apr 22, 2024 · 3 comments

Comments

@matgnt
Copy link

matgnt commented Apr 22, 2024

Hi,

I'm starting to use this library because I like to have those things generated from the specs! Good approach I think!

One question or feature request I had is about the serialization.

I'm following the example here:

https://aas-core30-python.readthedocs.io/en/latest/getting_started/jsonize.html

but what I would require in my project is a ValueOnly serialization as described here:

https://industrialdigitaltwin.org/wp-content/uploads/2023/04/IDTA-01002-3-0_SpecificationAssetAdministrationShell_Part2_API.pdf#%5B%7B%22num%22%3A254%2C%22gen%22%3A0%7D%2C%7B%22name%22%3A%22XYZ%22%7D%2C54%2C788%2C0%5D

My expectation would be to just use the same function

jsonable = aas_jsonization.to_jsonable(environment)

but probably pass in an additional parameter to indicate the desired meta data for serialization, e.g.

jsonable = aas_jsonization.to_jsonable(environment, value_only=True)

Any thoughts on this?
Thanks,

--
Matthias Binzer

@mristin
Copy link
Contributor

mristin commented Apr 22, 2024

@matgnt the ValueOnly serialization has a broken design -- so we didn't include it in the library. For example, what happens if your Property has its type set to a xs:double and the value is NaN etc.

Moreover, ValueOnly serialization can not be automatically generated. There are specific rules for each class, and these rules change between the versions of the meta-model. The logic is thus complicated and would require a substantial effort if we want to transpile it.

I think the easiest is to implement the meta-only and value-only serializations by hand. I wouldn't bother patching the original code of this SDK, but instead have parallel de/serialization functions which use the SDK to structure the inputs and the outputs, respectively.

@matgnt
Copy link
Author

matgnt commented Apr 26, 2024

Hi @mristin
thanks for the details. This is very unfortunate. But I can understand the reasoning.
Since in Catena-X [1] and its open source community [2] we currently use the ValueOnly serialization, this limits the benefit for us very much, I guess.

Is it possible to add this limitation to the Readme / Documentation?

[1] https://catena-x.net/
[2] https://github.com/eclipse-tractusx/

@mristin
Copy link
Contributor

mristin commented Apr 26, 2024

@matgnt we could add it as a manually-written module to the SDK. Would you be interested to help me with the implementation?

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

No branches or pull requests

2 participants