Typed document model
Document, Info, PathItem, Operation, Parameter, Response, Schema — every OpenAPI node as a real C++ struct, not stringly-typed maps.
Parse, validate, traverse, write and serve OpenAPI documents — with a typed document model and zero surprises.
Most C++ OpenAPI libraries stop at "parse to a JSON tree". swaggercpp goes further: it exposes OpenAPI nodes as regular C++23 structures, so tooling authors can inspect and manipulate specifications with normal field access and standard containers.
#include "swaggercpp/swaggercpp.hpp"
auto result = swaggercpp::DocumentReader::read_file("openapi.yaml");
if (!result) return 1;
swaggercpp::DocumentValidator validator;
const auto report = validator.validate(result.value());
for (const auto& op : result.value().paths) {
for (const auto& [method, operation] : op.second.operations) {
std::println("{} {} → {}", swaggercpp::to_string(method), op.first,
operation.operation_id.value_or("(anonymous)"));
}
}DocumentReader — format-detecting parser for JSON and YAMLDocumentWriter — serialiser with pretty-printing and round-trip helpersDocumentValidator — semantic checks independent of syntaxDocumentWalker — deterministic visitor traversalSwaggerUiServer — embedded HTTP server with Swagger UI shellResult<T> — non-throwing return type with issues attachedReleased under the MIT License.