feat: accept expanded deviceInfo fields in v1 devices#1021
feat: accept expanded deviceInfo fields in v1 devices#1021ShradhaGupta31 wants to merge 2 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 Harness. 🚀 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 |
f54a1fe to
c4d41ab
Compare
631815f to
5d2c185
Compare
5d2c185 to
b0cabfb
Compare
b0cabfb to
54b8bb6
Compare
cdb1c20 to
052a57c
Compare
2c554b6 to
cd42d27
Compare
cd42d27 to
e74f52b
Compare
mike is on vacation and his review comments would be addressed
@ShradhaGupta31 : I don't see this update openapi.json committed. |
- Udated deviceInfo payload as per the device discovery arch - Updated the v1 devices POST/GET flow to accomodate the full deviceInfo payload - Updated relevant testcases accordingly Signed-off-by: ShradhaGupta31 <shradha.gupta@intel.com>
e74f52b to
a280dbe
Compare
openapi.json is generated via CI/CD job. With above changes i have generated it locally, the responses were updated as per the latest device payloads. @madhavilosetty-intel please suggest if we need some manual update here? |
d72349c to
6d538fb
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