-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Labels
Milestone
Description
Feature request / General issue
Implement GET /areas/{area_id}/components endpoint to list components within a specific area with proper error handling for nonexistent areas.
Proposal
Add a REST API endpoint at GET /areas/{area_id}/components that returns all components belonging to a specific area. The endpoint should filter components by area from the
entity cache and provide proper error handling.
Response format (200 OK):
[
{
"id": "powertrain__engine",
"name": "engine",
"namespace": "/powertrain/engine",
"topic_count": 3
}
]
Error format (404 Not Found):
{
"error": "Area not found",
"area_id": "nonexistent"
}
Implementation:
- Add REST handler for GET /areas/{area_id}/components
- Extract area_id from URL path parameter
- Filter components by area from entity cache
- Return 404 with error message if area doesn't exist
- Return array of components in that area if found
Motivation
This endpoint is essential for:
- Area-scoped discovery: Enables clients to explore components within a specific domain (e.g., only powertrain components) without retrieving the entire system
- Hierarchical navigation: Supports UI patterns where users first select an area, then drill down into components
- Error handling patterns: Establishes proper REST error responses (404 for not found) that will be used consistently across all endpoints
- Performance optimization: Reduces payload size when clients only need to inspect one area of the robot
Alternatives considered
N/A
Additional context
N/A
Acceptance Criteria:
- curl http://localhost:8080/areas/powertrain/components returns components in powertrain area
- curl http://localhost:8080/areas/nonexistent/components returns 404 with error message
- colcon test passes
- README documents endpoint with both success and error examples