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

feat!: implement proper serialization logic #178

Merged
merged 5 commits into from
Jun 4, 2024
Merged

feat!: implement proper serialization logic #178

merged 5 commits into from
Jun 4, 2024

Conversation

JKRhb
Copy link
Member

@JKRhb JKRhb commented Jun 3, 2024

So far, there hasn't been a proper serialization implementation in place, which has been a major obstacle for adding ExposedThing functionality to the package. This PR changes that, making it possible to convert a Thing Description into a JSON (or CBOR) object.

The go-to approach for this kind of task in the Dart ecosystem is probably the json_serializable package. However, it seemed to me as if the annotation-based approach which is commonly used by that package (which also involves a generation step that I really dislike) is a bit too inflexible for the TD data model.

After the merge of this PR and maybe once the json_serializable has switched to using the new macros in the Dart language instead of their conventional builder-approach, we could consider replacing the (in some places somewhat inelegant implementation) with a nicer one that is close to the state of the art.

@codecov-commenter
Copy link

codecov-commenter commented Jun 3, 2024

Codecov Report

Attention: Patch coverage is 99.63504% with 1 line in your changes missing coverage. Please review.

Project coverage is 63.38%. Comparing base (e1040ff) to head (7755c3e).

Files Patch % Lines
lib/src/binding_coap/coap_client.dart 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #178      +/-   ##
==========================================
+ Coverage   58.50%   63.38%   +4.87%     
==========================================
  Files          77       78       +1     
  Lines        2010     2272     +262     
==========================================
+ Hits         1176     1440     +264     
+ Misses        834      832       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JKRhb
Copy link
Member Author

JKRhb commented Jun 4, 2024

The implementation is not perfect yet, but I will already merge it to move with this topic and pave the way for more interesting features.

In any case, adding this implementation had the benefit of uncovering a few bugs, which I was able to fix – codecov really incentivized me to also go for an almost complete coverage of the changes :)

@JKRhb JKRhb marked this pull request as ready for review June 4, 2024 23:12
@JKRhb JKRhb merged commit a65db02 into main Jun 4, 2024
5 checks passed
@JKRhb JKRhb deleted the serialization branch June 4, 2024 23: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.

2 participants