20#ifndef ORES_HTTP_DOMAIN_ROUTE_HPP
21#define ORES_HTTP_DOMAIN_ROUTE_HPP
28#include <boost/asio/awaitable.hpp>
29#include "ores.http.api/domain/http_method.hpp"
30#include "ores.http.api/domain/http_request.hpp"
31#include "ores.http.api/domain/http_response.hpp"
33namespace ores::http::domain {
40 std::string type =
"string";
42 bool required =
false;
43 std::string description;
44 std::optional<std::string> default_value;
54 std::string content_type =
"application/json";
56 std::string json_schema;
57 std::string example_json;
67 std::string status_code =
"200";
68 std::string description =
"Successful response";
69 std::string content_type =
"application/json";
70 std::string json_schema;
71 std::string example_json;
77using request_handler = std::function<
78 boost::asio::awaitable<http_response>(
const http_request&)>;
153 bool match(
const std::string& path,
154 std::unordered_map<std::string, std::string>& path_params)
const;
Represents an incoming HTTP request.
Definition http_request.hpp:35
Describes a query parameter for OpenAPI.
Definition route.hpp:38
Describes the request body schema for OpenAPI.
Definition route.hpp:53
Describes the response schema for OpenAPI.
Definition route.hpp:66
Represents a registered route with pattern matching.
Definition route.hpp:83
bool requires_auth
Whether this route requires authentication.
Definition route.hpp:112
std::string description
OpenAPI description for documentation.
Definition route.hpp:127
std::vector< std::string > param_names
Names of path parameters in order.
Definition route.hpp:102
std::vector< std::string > required_roles
Required roles for accessing this route (empty = any authenticated user).
Definition route.hpp:117
std::vector< std::string > tags
OpenAPI tags for grouping.
Definition route.hpp:132
request_handler handler
Handler function for the route.
Definition route.hpp:107
http_method method
HTTP method for this route.
Definition route.hpp:87
std::string summary
OpenAPI summary for documentation.
Definition route.hpp:122
std::optional< request_body_schema > body_schema
Request body schema for POST/PUT/PATCH routes.
Definition route.hpp:142
std::string pattern
Original path pattern (e.g., "/users/{id}").
Definition route.hpp:92
std::vector< query_param > query_params
Query parameters for this route.
Definition route.hpp:137
std::regex regex
Compiled regex for matching.
Definition route.hpp:97
std::optional< response_schema > success_response_schema
Response schema for the 200 response.
Definition route.hpp:147
bool match(const std::string &path, std::unordered_map< std::string, std::string > &path_params) const
Attempts to match the given path and extracts parameters.
Definition route.cpp:24