Skip to content

Commit da8b694

Browse files
committed
Update API documentation and schemas: clarify lock/unlock behavior for device fields and enhance error handling in device alias update
1 parent 28e6d62 commit da8b694

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

docs/API_DEVICE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ Allowed `columnName` values: `devName`, `devOwner`, `devType`, `devVendor`, `dev
217217
| Field | Type | Required | Description |
218218
|---|---|---|---|
219219
| `fieldName` | string || Field to lock/unlock (e.g. `devName`, `devVendor`) |
220-
| `lock` | boolean || `true` to lock (default), `false` to unlock |
220+
| `lock` | boolean || `true` to lock, `false` to unlock (default when omitted) |
221221

222222
**Response** (success):
223223

server/api_server/api_server_start.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,10 @@ def api_device_set_alias(mac, payload=None):
585585

586586
device_handler = DeviceInstance()
587587
result = device_handler.updateDeviceColumn(mac, 'devName', alias)
588+
589+
if not result.get("success") and result.get("error") == "Device not found":
590+
return jsonify(result), 404
591+
588592
return jsonify(result)
589593

590594

server/api_server/openapi/schemas.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ class UpdateDeviceColumnRequest(BaseModel):
417417
class LockDeviceFieldRequest(BaseModel):
418418
"""Request to lock/unlock a device field."""
419419
fieldName: str = Field(..., description="Field name to lock/unlock (e.g., devName, devVendor). Required.")
420-
lock: bool = Field(True, description="True to lock the field, False to unlock")
420+
lock: bool = Field(False, description="True to lock the field, False (default) to unlock")
421421

422422

423423
class UnlockDeviceFieldsRequest(BaseModel):
@@ -430,7 +430,7 @@ class UnlockDeviceFieldsRequest(BaseModel):
430430
None,
431431
description="List of field names to unlock. If omitted, all tracked fields will be unlocked"
432432
)
433-
clear_all: bool = Field(
433+
clearAll: bool = Field(
434434
False,
435435
description="True to clear all sources, False to clear only LOCKED/USER"
436436
)

0 commit comments

Comments
 (0)