Skip to content

feat(model): Make NetworkDeviceHardware robust to unknown JSON keys#3880

Merged
jamesarich merged 1 commit into
mainfrom
fix/device-hw
Dec 2, 2025
Merged

feat(model): Make NetworkDeviceHardware robust to unknown JSON keys#3880
jamesarich merged 1 commit into
mainfrom
fix/device-hw

Conversation

@jamesarich

Copy link
Copy Markdown
Collaborator

This commit enhances the NetworkDeviceHardware data class by adding the @JsonIgnoreUnknownKeys annotation. This makes JSON deserialization more resilient by preventing crashes if the devices.json file contains new, unknown properties.

Additionally, two new nullable fields, key and variant, have been added to the model to support future device definitions. The kotlinx-serialization-json dependency has been included in the core/model module to support these changes.

This commit enhances the `NetworkDeviceHardware` data class by adding the `@JsonIgnoreUnknownKeys` annotation. This makes JSON deserialization more resilient by preventing crashes if the `devices.json` file contains new, unknown properties.

Additionally, two new nullable fields, `key` and `variant`, have been added to the model to support future device definitions. The `kotlinx-serialization-json` dependency has been included in the `core/model` module to support these changes.

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
@codecov

codecov Bot commented Dec 2, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.53%. Comparing base (7e3d5c0) to head (0ba1c81).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...org/meshtastic/core/model/NetworkDeviceHardware.kt 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main   #3880      +/-   ##
========================================
- Coverage   0.53%   0.53%   -0.01%     
========================================
  Files        392     392              
  Lines      22938   22940       +2     
  Branches    2894    2894              
========================================
  Hits         122     122              
- Misses     22795   22797       +2     
  Partials      21      21              

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

@jamesarich jamesarich added the bugfix PR tag label Dec 2, 2025
@jamesarich jamesarich added this pull request to the merge queue Dec 2, 2025
Merged via the queue into main with commit 0c127bc Dec 2, 2025
7 checks passed
@jamesarich jamesarich deleted the fix/device-hw branch December 2, 2025 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant