Skip to content

Implement GET /areas/{area_id}/components endpoint to list components within a specific area #16

@mfaferek93

Description

@mfaferek93

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:

  1. Area-scoped discovery: Enables clients to explore components within a specific domain (e.g., only powertrain components) without retrieving the entire system
  2. Hierarchical navigation: Supports UI patterns where users first select an area, then drill down into components
  3. Error handling patterns: Establishes proper REST error responses (404 for not found) that will be used consistently across all endpoints
  4. 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:

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions