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

Constrained integers #298

Open
mristin opened this issue Dec 20, 2023 · 0 comments
Open

Constrained integers #298

mristin opened this issue Dec 20, 2023 · 0 comments

Comments

@mristin
Copy link
Contributor

mristin commented Dec 20, 2023

In the current state, aas-core-codegen supports integer primitives although they are not part of the official meta-model yet. If the integers become part of the meta-model, we have to make sure that they are all constrained to the range [-2^53 + 1, 2^53 - 1], i.e. [-9007199254740991, 9007199254740991], (both inclusive) so that the JSON format is interoperable with XML and other formats.

JSON intrinsically represents numbers as 64-bit floats, so there might be silent precision loss.

Such a constraint can be implemented by a unit test in aas-core-meta which checks that all integers are constrained, similar to how we check that all strings are serializable to XML.

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

1 participant