https://github.com/porter-dev/api-contracts
API contracts for use across multiple services
https://github.com/porter-dev/api-contracts
Last synced: 5 months ago
JSON representation
API contracts for use across multiple services
- Host: GitHub
- URL: https://github.com/porter-dev/api-contracts
- Owner: porter-dev
- Created: 2023-02-21T17:27:17.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-28T15:40:50.000Z (over 1 year ago)
- Last Synced: 2025-06-22T07:07:51.226Z (9 months ago)
- Language: JavaScript
- Size: 3.45 MB
- Stars: 2
- Watchers: 3
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# API Contracts
API contracts for use across multiple services
- Protobuf contracts in Go generated using `task all`
- gRPC Server using [Connect RPC](https://connectrpc.com/docs/introduction/)
- gRPC Server generated using `task all`
## Contributing
To start working on this, run the following commands:
```shell
# install task
brew install go-task/tap/go-task
# install dependencies
task install-tools
```
## Installing
NPM:
```bash
npm i --legacy-peer-deps @porter-dev/api-contracts
```
Go
```
go get -u github.com/porter-dev/api-contracts
```
## Usage
- Make changes to the `generated/porter/v1` protos as needed
- Run `task all` before committing your changes to the PR. This will run the PR prechecks, as well as generate any new code required.
- Create a PR
- Upon subsequent changes to your PR, ensure you run `task all` or your changes will not be included in the merged release.
Note: if you have created any new files in your release, be sure to export them in the `index.ts` file found in `generated/js` (this file is not in fact generated).
## Creating a release
- Visit [Github Releases](https://github.com/porter-dev/api-contracts/releases)
- Click `Create a new release`
- Click `Choose a tag`, and choose the semantic version that suits your release type. Make sure this begins with `v` and is of the format `vX.Y.Z`
- Click `Create new tag`
- Set the form title to with the tag name that you just created
- Click "Generate release notes", then fill out an additionally required information
## Updating message formats
Please consult this guide for best practices on updating message types for backward- and forward-compatability: https://protobuf.dev/programming-guides/proto3/#updating
## Local development
Assuming that you use `workstation`:
### Porter dashboard
In the folder containing your `package.json`, run the following:
`npm i --save --legacy-peer-deps ../../api-contracts/generated/js`
## Porter server
In the folder containing your `go.mod`, run the following:
```bash
go mod edit -replace github.com/porter-dev/api-contracts=../api-contracts
go mod vendor
go mod tidy
```
### Cluster Control Plane
In the folder containing your `go.mod`, run the following:
```bash
go mod edit -replace github.com/porter-dev/api-contracts=../api-contracts
go mod vendor
go mod tidy
```