Skip to content

Fault-trigger routes still use raw() although their typed DTOs exist #645

Description

@bburda

Summary

The fault-trigger CRUD routes are still registered with RouteRegistry::raw(), so their request and response bodies are written by hand instead of coming from a DTO descriptor.

In src/ros2_medkit_gateway/src/http/rest_server.cpp the three routes GET, POST and DELETE on /{entity}/fault-triggers use ->raw(...). The comment above them explains the reason as "no typed DTO".

That reason is no longer true. Three typed DTOs exist and are registered in AllDtos:

  • FaultTriggerRule
  • FaultTriggerRuleCreateRequest
  • FaultTriggerRuleList

So the schemas are generated, but the routes do not use them. The body a client sends is still parsed by hand, and the body the gateway returns is still built by hand. If one side changes, nothing fails.

Proposed solution (optional)

Register the three routes as typed routes using the DTOs that already exist, and drop the raw() calls. The response body is built from FaultTriggerEngine::rule_to_json, so the DTO has to describe exactly what that function returns, or the change moves the mismatch instead of removing it.

If some part cannot be typed, keep raw() for that part only and update the comment to say what actually blocks it.

Additional context (optional)

raw() stays useful for routes that have no fixed shape. The point here is only that these three do have one now.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions