refactor: accept expanded deviceInfo fields in v1 devices#1021
refactor: accept expanded deviceInfo fields in v1 devices#1021ShradhaGupta31 wants to merge 5 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1021 +/- ##
==========================================
+ Coverage 41.66% 41.71% +0.04%
==========================================
Files 135 135
Lines 12433 12488 +55
==========================================
+ Hits 5180 5209 +29
- Misses 6698 6722 +24
- Partials 555 557 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Updates the v1 /api/v1/devices DTO/usecase flow to accept and persist an expanded deviceInfo payload (including unknown/extra fields), supporting the Device Discovery requirements in #1020.
Changes:
- Persist
deviceInfoby JSON-marshallingdto.DeviceInfointoentity.Device.DeviceInfo(string) and unmarshalling it back on reads. - Expand
dto.DeviceInfowith additional fields and custom JSON (un)marshal logic to round-trip unknown fields viaExtraFields. - Add/adjust unit tests and update the v1 devices Postman request example to include the expanded
deviceInfo.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/usecase/devices/usecase.go | Marshals/unmarshals deviceInfo between DTO and entity; allows partial-update setter for deviceInfo. |
| internal/usecase/devices/repo_test.go | Updates partial-update tests to include deviceInfo persistence/round-trip expectations. |
| internal/entity/dto/v1/device.go | Expands DeviceInfo and adds custom JSON round-tripping for unknown fields (ExtraFields). |
| internal/entity/dto/v1/device_test.go | Adds a JSON round-trip test for DeviceInfo, including ExtraFields. |
| internal/controller/httpapi/v1/devices_test.go | Adds controller-level test ensuring POST accepts full deviceInfo payload. |
| integration-test/collections/console_mps_apis.postman_collection.json | Updates Postman sample request body to include full deviceInfo. |
|
OpenAPI spec is stale. CLAUDE.md requires regenerating the spec in the same PR: go run ./cmd/openapi-genThen commit the regenerated |
rsdmike
left a comment
There was a problem hiding this comment.
Great first attack at this, thanks for doing this! Please see my comments. Most important we def need to remove the complexity with the deletes. Thanks!
|
Hi, please take a look at #905 it contains the lmsinstalled part of deviceInfo |
* Wire deviceInfo serialization/deserialization in dtoToEntity/entityToDTO * Merge isLMSAvailable from activation into deviceInfo.lmsInstalled * Add LMSInstalled field to DeviceInfo DTO struct Related to device-management-toolkit/rpc-go#1246
f54a1fe to
c4d41ab
Compare
c4d41ab to
c0c208d
Compare
- Update the v1 devices POST/GET flow to accomodate the full deviceInfo payload Adresses - #1020 Signed-off-by: ShradhaGupta31 <shradha.gupta@intel.com>
631815f to
5d2c185
Compare
5d2c185 to
b0cabfb
Compare
b0cabfb to
54b8bb6
Compare
052a57c to
2ddab90
Compare
2ddab90 to
2c554b6
Compare
Adresses - #1020
Step 1: Fetch auth token
Step 2: Use POST api to add device information
Step 3: Fetch list of all known devices along with there respective discovery data
Step 4: Fetch discovery data of a particular GUID