Pisyukaev / axxon-proto2ts

This is a simple tool to convert Axxon proto files to typescript interfaces.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Axxon proto to ts converter

This is a simple tool to convert Axxon proto files to typescript interfaces.

Important

We must have protoc installed in our system to use this tool. If you don't have it installed, you can install it by following the instructions here.

Installation

Clone the repository

git clone https://github.com/Pisyukaev/axxon-proto2ts.git

Install the dependencies

cd axxon-proto2ts
pnpm install

Install protoc if you don't have it installed in your system. You can install it by following the instructions here.

Usage

Move all proto files/folders with proto to the proto directory Run the following command to convert the proto files to typescript interfaces

pnpm run ts:gen

The generated typescript interfaces will be saved in the types directory

Note

The generated typescript interfaces may need some manual adjustments to work properly.

Example

Input

syntax = "proto3";
package docs;

message User {
  string first_name = 1;
  string last_name = 2;
  bool active = 3;
  User manager = 4;
  repeated string locations = 5;
  map<string, string> projects = 6;
}

Output

/* eslint-disable */

export const protobufPackage = "docs";

export interface User {
  first_name: string;
  last_name: string;
  active: boolean;
  manager: User | undefined;
  locations: string[];
  projects: { [key: string]: string };
}

export interface User_ProjectsEntry {
  key: string;
  value: string;
}

License

MIT

About

This is a simple tool to convert Axxon proto files to typescript interfaces.

License:MIT License