Skip to content

build(gateway): HTTP layer in the ROS-free core - #758

Open
bburda wants to merge 4 commits into
feat/gateway-core-7-sse-fault-sourcefrom
feat/gateway-core-8-build-split
Open

bburda wants to merge 4 commits into
feat/gateway-core-7-sse-fault-sourcefrom
feat/gateway-core-8-build-split

Conversation

@bburda

@bburda bburda commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

Pull Request

Summary

The HTTP layer is built into gateway_core. The core reuses an existing httplib::httplib target and handles ENABLE_SWAGGER_UI. It compiles with the smaller precompiled header of gateway_core, without rclcpp headers.

scripts/check_cores_without_ros now also builds the gateway core, starts the REST server over minimal GatewayServices and reads /api/v1/health.


Issue


Type

  • Bug fix
  • New feature or tests
  • Breaking change
  • Documentation only

Testing

  • ./scripts/test.sh unit --packages-select ros2_medkit_gateway
  • ./scripts/test.sh integ --packages-select ros2_medkit_integration_tests
  • src/ros2_medkit_gateway/scripts/check_core_purity.sh
  • scripts/check_cores_without_ros/run.sh exits 0.

Checklist

  • Breaking changes are clearly described (and announced in docs / changelog if needed)
  • Tests were added or updated if needed
  • Docs were updated if behavior or public API changed

Build the HTTP layer into the ROS-free gateway core library. The core
reuses httplib::httplib and handles ENABLE_SWAGGER_UI. The core compiles and is
tested without ROS and without DDS setup. scripts/check_cores_without_ros
serves gateway health over HTTP from the core.
@bburda
bburda added this pull request to stack #759 October 24, 2026 14:18
@bburda bburda self-assigned this Oct 24, 2026
…ersion

RestConfig gains server_name, vendor_name and server_version, so a program that hosts the core names its own server on GET /, GET /version-info and in the OpenAPI documents. The defaults are the values the ROS 2 node reports, and the node sets nothing.
endif()

if(NOT TARGET cpp_httplib_target)
if(TARGET httplib::httplib)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An existing httplib::httplib target is reused without a version check. medkit_find_cpp_httplib() deliberately rejects >= 0.20 because the handlers still use the multipart MultipartFormData/req.files API, so a plain-CMake build that already defines a newer httplib fails to compile. Apply the same < 0.20 check here, or fall back to the vendored header when httplib_VERSION is 0.20 or newer.

export -f compile_check
echo "Core purity: ${#ROS_FREE_SOURCES[@]} sources, ${#ROS_FREE_HEADERS[@]} headers compiled without ROS."
failed=$(printf '%s\n' "${ROS_FREE_SOURCES[@]}" "${ROS_FREE_HEADERS[@]}" |
xargs -P "$(nproc)" -I{} bash -c 'compile_check {} || echo FAILED' | tee /dev/stderr | grep -c '^FAILED' || true)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compile check passes without compiling anything if xargs itself fails. For example nproc is missing (macOS), so -P "" is rejected: no FAILED line is printed, grep -c prints 0 and || true hides the pipeline status. Check the xargs exit status separately from the count, or fail when the number of checked files does not match ${#ROS_FREE_SOURCES[@]} + ${#ROS_FREE_HEADERS[@]}.

The Swagger UI page title now takes the server name from the server identity, HTML-escaped, and keeps the API Documentation suffix.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build the gateway HTTP layer into gateway_core

2 participants