Welcome to the PaaSTech Proto Definitions repository!
This repository contains the protocol buffer definitions for PaaSTech Cloud services.
This README provides instructions on how to use the proto definitions and how to add new ones.
Using the PaaSTech Proto Definitions is straightforward.
Just follow these simple steps:
- Open your
package.json
file in your project. - Under the
dependencies
section, add the following line:
"dependencies": {
// ...
"paastech-proto": "github:paastech-cloud/proto#main"
}
You will both find .proto
files and TS type definitions in the node_modules/paastech-proto/
folder.
- Open your
Cargo.toml
file in your project. - Under the
[dependencies]
section, add the following line:
[dependencies]
# ...
paastech-proto = { git = "https://github.com/paastech-cloud/proto.git", branch = "main" }
Alternatively, you can specify a specific version using a commit hash:
[dependencies]
# ...
paastech-proto = { git = "https://github.com/paastech-cloud/proto.git", rev = "1520c87" }
ℹ️ Note that using
rev
is more stable, because withbranch
the code can change at any time.
- That's it!! 🎉
You're all set to use the PaaSTech Proto Definitions in your project.
For example, you can import a specific proto package using theuse
keyword:
use paastech_proto::your_proto_package;
Source: The Cargo Book - Specifying dependencies from git repositories
To contribute a new proto definition, please follow these steps:
- Fork this repository or create a new branch for your changes.
- In the
proto/
directory, add your.proto
file. - In the
src/lib.rs
file, add a new module with the name of your proto package.
Make sure to include the macrotonic::include_proto!()
in this module. - In the
build.rs
file, add a line to compile your proto file using thetonic_build::compile_protos()
macro. Specify the path to your proto file in the function call. - Run
npm run generate:proto
to generate the TS type definitions. - Create a pull request with your changes.
Once your pull request is reviewed and merged, your proto definition will be available for others to use.