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

Make type violations more explicit for XML #12

Merged
merged 1 commit into from
Jun 21, 2023

Conversation

mristin
Copy link
Contributor

@mristin mristin commented Jun 21, 2023

We generated type violations as unexpected lists for non-lists, and strings for lists, respectively. This works well in JSON, but not is not so clear in XML. The lists in XML are serialized as a sequence of XML elements, which resembles also the serialization of the properties. Hence, when a list is passed in insteead of an atomic value, the first element in the list is interpreted as an invalid (additional, unexpected) property rather than list in XML.

With this change, we explicitly put a string where anything non-primitive is expected, and a reference where primitive values are expected. This way we make the type violations more explicit which in turn makes the debugging in the SDKs easier, since more meaningful errors are reported.

We generated type violations as unexpected lists for non-lists, and
strings for lists, respectively. This works well in JSON, but not is not
so clear in XML. The lists in XML are serialized as a sequence of XML
elements, which resembles also the serialization of the properties.
Hence, when a list is passed in insteead of an atomic value, the first
element in the list is interpreted as an invalid (additional,
unexpected) property rather than list in XML.

With this change, we explicitly put a string where anything
non-primitive is expected, and a reference where primitive values are
expected. This way we make the type violations more explicit which in
turn makes the debugging in the SDKs easier, since more meaningful
errors are reported.
@mristin mristin merged commit db69277 into main Jun 21, 2023
@mristin mristin deleted the mristin/Make-type-violations-more-explicit-for-XML branch June 21, 2023 07:54
mristin added a commit that referenced this pull request Jun 21, 2023
In #12, we made type violations explicit for non-primitives. However,
for enumerations, the type violations are now misinterpreted as invalid
enumeration literals, as enumerations in JSON and XML are represented as
strings.

In this patch, we generate type violations for enumerations as
unexpected instances to avoid confusion due to uninformative messages
reported from the SDKs.
mristin added a commit that referenced this pull request Jun 21, 2023
In #12, we made type violations explicit for non-primitives. However,
for enumerations, the type violations are now misinterpreted as invalid
enumeration literals, as enumerations in JSON and XML are represented as
strings.

In this patch, we generate type violations for enumerations as
unexpected instances to avoid confusion due to uninformative messages
reported from the SDKs.
mristin added a commit to aas-core-works/aas-core3.0-csharp that referenced this pull request Jun 24, 2023
We update the development requirements to and re-generate everything
with:
* [aas-core-meta 44756fb],
* [aas-core-codegen e2b793f] and
* [aas-core3.0-testgen bf3720d7].

This is an important patch propagating in particular the following fixes
which affected the constraints and their documentation:

* Pull requests in aas-core-meta [#271], [#272] and [#273] which affect the
  nullability checks in constraints,
* Pull request in aas-core-meta [#275] which affects the documentation
  of many constraints.

This patch also includes a propagation of improved test data:

* Pull request in aas-core3.0-testgen [#12] which makes the
  errors in XML more meaningful and easier to debug, and
* Pull request in aas-core3.0-testgen [#13] which makes the type
  violations of enumerations more explicit and thus easier to debug.

[aas-core-meta 44756fb]: aas-core-works/aas-core-meta@44756fb
[aas-core-codegen e2b793f]: aas-core-works/aas-core-codegen@e2b793f
[aas-core3.0-testgen bf3720d7]: aas-core-works/aas-core3.0-testgen@bf3720d7

[#271]: aas-core-works/aas-core-meta#271
[#272]: aas-core-works/aas-core-meta#272
[#273]: aas-core-works/aas-core-meta#273
[#275]: aas-core-works/aas-core-meta#275

[#12]: aas-core-works/aas-core3.0-testgen#12
[#13]: aas-core-works/aas-core3.0-testgen#13
mristin added a commit to aas-core-works/aas-core3.0-csharp that referenced this pull request Jun 24, 2023
…18)

We update the development requirements to and re-generate everything
with:
* [aas-core-meta 44756fb],
* [aas-core-codegen e2b793f] and
* [aas-core3.0-testgen bf3720d7].

This is an important patch propagating in particular the following fixes
which affected the constraints and their documentation:

* Pull requests in aas-core-meta [#271], [#272] and [#273] which affect the
  nullability checks in constraints,
* Pull request in aas-core-meta [#275] which affects the documentation
  of many constraints.

This patch also includes a propagation of improved test data:

* Pull request in aas-core3.0-testgen [#12] which makes the
  errors in XML more meaningful and easier to debug, and
* Pull request in aas-core3.0-testgen [#13] which makes the type
  violations of enumerations more explicit and thus easier to debug.

[aas-core-meta 44756fb]: aas-core-works/aas-core-meta@44756fb
[aas-core-codegen e2b793f]: aas-core-works/aas-core-codegen@e2b793f
[aas-core3.0-testgen bf3720d7]: aas-core-works/aas-core3.0-testgen@bf3720d7

[#271]: aas-core-works/aas-core-meta#271
[#272]: aas-core-works/aas-core-meta#272
[#273]: aas-core-works/aas-core-meta#273
[#275]: aas-core-works/aas-core-meta#275

[#12]: aas-core-works/aas-core3.0-testgen#12
[#13]: aas-core-works/aas-core3.0-testgen#13
mristin added a commit to aas-core-works/aas-core3.0-python that referenced this pull request Jun 24, 2023
We update the development requirements to and re-generate everything
with:
* [aas-core-meta 44756fb],
* [aas-core-codegen 607f65c] and
* [aas-core3.0-testgen bf3720d7].

This is an important patch propagating in particular the following fixes
which affected the constraints and their documentation:

* Pull requests in aas-core-meta [#271], [#272] and [#273] which affect the
  nullability checks in constraints,
* Pull request in aas-core-meta [#275] which affects the documentation
  of many constraints.

This patch also includes a propagation of improved test data:

* Pull request in aas-core3.0-testgen [#12] which makes the
  errors in XML more meaningful and easier to debug, and
* Pull request in aas-core3.0-testgen [#13] which makes the type
  violations of enumerations more explicit and thus easier to debug.

[aas-core-meta 44756fb]: aas-core-works/aas-core-meta@44756fb
[aas-core-codegen 607f65c]: aas-core-works/aas-core-codegen@607f65c
[aas-core3.0-testgen bf3720d7]: aas-core-works/aas-core3.0-testgen@bf3720d7

[#271]: aas-core-works/aas-core-meta#271
[#272]: aas-core-works/aas-core-meta#272
[#273]: aas-core-works/aas-core-meta#273
[#275]: aas-core-works/aas-core-meta#275

[#12]: aas-core-works/aas-core3.0-testgen#12
[#13]: aas-core-works/aas-core3.0-testgen#13
mristin added a commit to aas-core-works/aas-core3.0-python that referenced this pull request Jun 24, 2023
)

We update the development requirements to and re-generate everything
with:
* [aas-core-meta 44756fb],
* [aas-core-codegen 607f65c] and
* [aas-core3.0-testgen bf3720d7].

This is an important patch propagating in particular the following fixes
which affected the constraints and their documentation:

* Pull requests in aas-core-meta [#271], [#272] and [#273] which affect the
  nullability checks in constraints,
* Pull request in aas-core-meta [#275] which affects the documentation
  of many constraints.

This patch also includes a propagation of improved test data:

* Pull request in aas-core3.0-testgen [#12] which makes the
  errors in XML more meaningful and easier to debug, and
* Pull request in aas-core3.0-testgen [#13] which makes the type
  violations of enumerations more explicit and thus easier to debug.

[aas-core-meta 44756fb]: aas-core-works/aas-core-meta@44756fb
[aas-core-codegen 607f65c]: aas-core-works/aas-core-codegen@607f65c
[aas-core3.0-testgen bf3720d7]: aas-core-works/aas-core3.0-testgen@bf3720d7

[#271]: aas-core-works/aas-core-meta#271
[#272]: aas-core-works/aas-core-meta#272
[#273]: aas-core-works/aas-core-meta#273
[#275]: aas-core-works/aas-core-meta#275

[#12]: aas-core-works/aas-core3.0-testgen#12
[#13]: aas-core-works/aas-core3.0-testgen#13
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

Successfully merging this pull request may close these issues.

1 participant