-
Notifications
You must be signed in to change notification settings - Fork 56
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: REST API to update entity twin data #3425
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is Additional details and impacted files📢 Thoughts on this report? Let us know! |
Robot Results
|
57d1501
to
7f8012a
Compare
7f8012a
to
e8a524c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- It would be good to implement
tedge http patch
along this PR. - I was expecting the updated twin data to be published over the
twin
topics.
#[error("Fragment keys starting with '@' are not allowed as twin data")] | ||
pub struct InvalidTwinData; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to tell which key has been rejected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved by 6e7c4c6
Update existing fragment: `name`, add new fragment: `hardware` and remove existing fragment: `maintenanceMode` with a `null` value: | ||
|
||
```json | ||
{ | ||
"name": "Child 01", | ||
"new-fragment": { | ||
"new-key": "new-value" | ||
}, | ||
"extra-fragment": null | ||
} | ||
``` | ||
|
||
**Example** | ||
|
||
```shell | ||
curl http://localhost:8000/tedge/entity-store/v1/entities/device/child01 \ | ||
-X PATCH \ | ||
-H "Content-Type: application/json" \ | ||
-d '{ | ||
"type": "Raspberry Pi 4", | ||
"hardware": { | ||
"serialNo": "98761234" | ||
}, | ||
"maintenanceMode": null | ||
}' | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example doesn't match the text.
Update existing fragment: `name`, add new fragment: `hardware` and remove existing fragment: `maintenanceMode` with a `null` value: | |
```json | |
{ | |
"name": "Child 01", | |
"new-fragment": { | |
"new-key": "new-value" | |
}, | |
"extra-fragment": null | |
} | |
``` | |
**Example** | |
```shell | |
curl http://localhost:8000/tedge/entity-store/v1/entities/device/child01 \ | |
-X PATCH \ | |
-H "Content-Type: application/json" \ | |
-d '{ | |
"type": "Raspberry Pi 4", | |
"hardware": { | |
"serialNo": "98761234" | |
}, | |
"maintenanceMode": null | |
}' | |
``` | |
Update existing fragment: `name`, add new fragment: `hardware` and remove existing fragment: `maintenanceMode` with a `null` value: | |
```shell | |
curl http://localhost:8000/tedge/entity-store/v1/entities/device/child01 \ | |
-X PATCH \ | |
-H "Content-Type: application/json" \ | |
-d '{ | |
"name": "Child 01", | |
"hardware": { | |
"serialNo": "98761234" | |
}, | |
"maintenanceMode": null | |
}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved by 6e7c4c6
I pushed a commit for that: 4e3e940 |
4e3e940
to
6e7c4c6
Compare
Resolved by 6e7c4c6 |
Proposed changes
REST API to update entity twin data
Types of changes
Paste Link to the issue
Checklist
cargo fmt
as mentioned in CODING_GUIDELINEScargo clippy
as mentioned in CODING_GUIDELINESFurther comments