# oatpp-protobuf **Repository Path**: mirrors_oatpp/oatpp-protobuf ## Basic Information - **Project Name**: oatpp-protobuf - **Description**: Use protobuf messages as regular oatpp DTOs - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-01-26 - **Last Updated**: 2025-12-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # oatpp-protobuf **Alpha** **Since oatpp 1.2.0** Protobuf messages integration with oatpp object-mapping framework. Now you can use protobuf messages as regular oatpp DTOs! More about Oat++: - [Oat++ Website](https://oatpp.io/) - [Oat++ Github Repository](https://github.com/oatpp/oatpp) ## Usage Let's say we have a .proto file: ```proto syntax = "proto3"; message User { enum Role { ADMIN = 0; GUEST = 1; } string name = 1; Role role = 2; } ``` ### In Endpoint ```cpp ENDPOINT("POST", "createUser", createUser, BODY_DTO(oatpp::protobuf::Object, user)) { auto name = user->name(); auto role = user->role(); ... return createResponse(Status::CODE_200, "OK"); } ``` ```cpp ENDPOINT("GET", "getUser", getUser) { oatpp::protobuf::Object user = std::make_shared(); user->set_name("Ivan"); user->set_role(User_Role_GUEST); return createDtoResponse(Status::CODE_200, user); } ``` Output: ```json { "name": "Ivan", "role": "GUEST" } ```