Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
b6dfc81
feat(gateway): add DTO contract core (Field, dto_fields, traits)
bburda May 17, 2026
aadffc5
feat(gateway): add SchemaWriter visitor for DTO->OpenAPI schema
bburda May 17, 2026
b6ba51e
feat(gateway): add JsonWriter visitor for DTO->wire JSON
bburda May 17, 2026
8a8c6bf
feat(gateway): add JsonReader visitor with lenient validation
bburda May 17, 2026
fe9f46b
feat(gateway): add DTO sample synthesizer and round-trip self-test
bburda May 17, 2026
4022609
feat(gateway): add DTO registry and component-schema collection
bburda May 17, 2026
280d062
fix(gateway): clang-tidy cleanup of the DTO contract headers
bburda May 18, 2026
794eaab
feat(gateway): add DTO enum vocabularies and GenericError
bburda May 18, 2026
6d6998c
feat(gateway): add typed x-medkit DTOs with nested ros2 sub-object
bburda May 18, 2026
a37da14
feat(gateway): add entity DTOs and register them in AllDtos
bburda May 18, 2026
fe1bb1a
refactor(gateway): merge DTO schemas into component_schemas()
bburda May 18, 2026
1cca8b4
feat(gateway): add HandlerContext send_dto/parse_body
bburda May 18, 2026
992a1eb
feat(gateway): add typed response<T>/request_body<T> route overloads
bburda May 18, 2026
2ed66dd
refactor(gateway): migrate handle_list_areas to DTO contract
bburda May 18, 2026
f45ae97
refactor(gateway): migrate all discovery handlers to DTO contract
bburda May 18, 2026
2716e29
refactor(gateway): retype entity routes, drop entity schema factories
bburda May 18, 2026
a6b10ef
feat(gateway): add fault DTOs
bburda May 18, 2026
8ed1586
refactor(gateway): migrate fault handlers to DTO contract
bburda May 18, 2026
ab45638
feat(gateway): add operation DTOs
bburda May 18, 2026
8a166a2
refactor(gateway): migrate operation handlers to DTO contract
bburda May 18, 2026
03bee41
refactor(gateway): type fault x-medkit, drop legacy builder from faul…
bburda May 18, 2026
0cfc84b
feat(gateway): add configuration DTOs
bburda May 18, 2026
7631f4e
refactor(gateway): migrate configuration handlers to DTO contract
bburda May 18, 2026
ca1ce22
feat(gateway): add data DTOs
bburda May 18, 2026
4c62658
refactor(gateway): migrate data handlers to DTO contract
bburda May 18, 2026
3e5b6f0
feat(gateway): add lock DTOs
bburda May 18, 2026
3f4991a
refactor(gateway): migrate lock handlers to DTO contract
bburda May 18, 2026
9f3744c
feat(gateway): add trigger DTOs
bburda May 18, 2026
bcf60f6
refactor(gateway): migrate trigger handlers to DTO contract
bburda May 18, 2026
2b2caa5
feat(gateway): add cyclic subscription DTOs
bburda May 18, 2026
22b72ea
refactor(gateway): migrate cyclic subscription handlers to DTO contract
bburda May 18, 2026
3119925
feat(gateway): add bulk-data DTOs
bburda May 18, 2026
8e7e62c
refactor(gateway): migrate bulk-data handlers to DTO contract
bburda May 18, 2026
0757fcb
feat(gateway): add log DTOs
bburda May 18, 2026
420c624
refactor(gateway): migrate log handlers to DTO contract
bburda May 18, 2026
fead3b4
feat(gateway): add script DTOs
bburda May 18, 2026
6258bc5
refactor(gateway): migrate script handlers to DTO contract
bburda May 18, 2026
dc83d97
feat(gateway): add software update DTOs
bburda May 18, 2026
4cc2127
refactor(gateway): migrate software update handlers to DTO contract
bburda May 18, 2026
cd2cc16
feat(gateway): add auth DTOs
bburda May 18, 2026
3638415
refactor(gateway): migrate auth handlers to DTO contract
bburda May 18, 2026
7e8b375
feat(gateway): add health and version-info DTOs
bburda May 18, 2026
486ff9e
refactor(gateway): migrate health handlers to DTO contract
bburda May 18, 2026
b14a550
refactor(gateway): remove the legacy XMedkit builder
bburda May 18, 2026
e7e05e0
test(gateway): validate live responses against the OpenAPI spec
bburda May 18, 2026
2878284
docs(gateway): document the DTO contract layer
bburda May 18, 2026
832107f
fix(gateway): preserve custom capability validation for execution upd…
bburda May 18, 2026
e95cdbf
refactor(gateway): remove dead JSON serialization helpers
bburda May 18, 2026
3a2438b
docs(gateway): constrain field_enum to string members and note the ag…
bburda May 18, 2026
87145b5
test(gateway): update ExecutionUpdateRequest schema assertion after c…
bburda May 18, 2026
1bed0f8
docs(gateway): fix definition list term in the DTO contract design doc
bburda May 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Beyond faults, medkit exposes the full ROS 2 graph through REST:
| **Software Updates** | Async prepare/execute lifecycle with pluggable backends |
| **Authentication** | JWT-based RBAC (viewer, operator, configurator, admin) |
| **Logs** | Log entries and configuration |
| **Docs** | OpenAPI 3.1.0 spec and Swagger UI at `/api/v1/docs` |
| **Docs** | OpenAPI 3.1.0 spec and Swagger UI at `/api/v1/docs` - schemas are generated from typed C++ structs so the spec always matches the wire format |

On the [roadmap](https://selfpatch.github.io/ros2_medkit/roadmap.html): entity lifecycle control, mode management, communication logs.

Expand Down
22 changes: 22 additions & 0 deletions docs/tutorials/openapi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,28 @@ When disabled, all ``/docs`` endpoints return HTTP 501.

See :doc:`/config/server` for the full parameter reference.

How Schemas Are Generated
--------------------------

The ``components/schemas`` object in every ``/docs`` response is generated
automatically from the DTO registry. Each response and request type in the
gateway is declared as a plain C++ struct with a ``constexpr dto_fields<T>``
descriptor tuple. The ``SchemaWriter<T>`` visitor folds over this tuple at
compile time to produce the OpenAPI JSON Schema entry, and the
``AllDtos`` registry in ``dto/registry.hpp`` lists every named type so that
``collect_component_schemas()`` can populate the full schema map without
any hand-written schema factories.

The same descriptor is used for serialization (``JsonWriter<T>``) and
request-body validation (``JsonReader<T>``), so the wire shape and the
published schema are always derived from the same source. Genuinely dynamic
payloads - such as live ROS 2 message data and free-form fault environment
records - are typed as ``nlohmann::json`` members and appear in the schema
as unconstrained objects (``{}``).

For the full design of the DTO contract layer, see
:doc:`/design/ros2_medkit_gateway/dto_contract`.

See Also
--------

Expand Down
7 changes: 3 additions & 4 deletions src/ros2_medkit_gateway/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -631,9 +631,9 @@ if(BUILD_TESTING)
target_link_libraries(test_handler_context gateway_ros2)
medkit_set_test_domain(test_handler_context)

# Add x-medkit extension tests
ament_add_gtest(test_x_medkit test/test_x_medkit.cpp)
target_link_libraries(test_x_medkit gateway_ros2)
# DTO contract core (pure C++17, no ROS node)
ament_add_gtest(test_dto_contract test/test_dto_contract.cpp)
target_link_libraries(test_dto_contract gateway_core)

# Add rate limiter tests
ament_add_gtest(test_rate_limiter test/test_rate_limiter.cpp)
Expand Down Expand Up @@ -929,7 +929,6 @@ if(BUILD_TESTING)
test_manifest_manager
test_capability_builder
test_handler_context
test_x_medkit
test_rate_limiter
test_auth_config
test_data_access_manager
Expand Down
Loading
Loading