https://github.com/yszk0123/protobuf-to-openapi-test
https://github.com/yszk0123/protobuf-to-openapi-test
openapi protobuf typescript
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/yszk0123/protobuf-to-openapi-test
- Owner: yszk0123
- Created: 2025-03-20T06:24:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-20T17:40:13.000Z (over 1 year ago)
- Last Synced: 2025-07-19T06:42:54.882Z (12 months ago)
- Topics: openapi, protobuf, typescript
- Language: TypeScript
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Protobuf to OpenAPI Test
This is a sample server application that generates OpenAPI definitions from Protobuf using Buf and implements a server in TypeScript.
## Prerequisites
- Node.js (v16 or higher)
- pnpm
- Buf CLI
## Setup
1. Install dependencies:
```bash
pnpm install
```
2. Generate TypeScript code from Protobuf definitions:
```bash
pnpm generate
```
See generated OpenAPI client code:
```bash
cat src/generated/openapi/api.swagger.json.client.ts
```
3. Start development server:
```bash
pnpm dev
```
## API Endpoints
- GET /posts: Get list of posts
- POST /posts: Create a post
- PUT /posts/:postId: Update a post
- DELETE /posts/:postId: Delete a post
## Project Structure
```
proto/
blog/
post.proto
buf.yaml
src/
index.ts
package.json
tsconfig.json
buf.work.yaml
```