@approvio/api
v0.0.55
Published
This repository contains the OpenAPI specification for the Approvio backend, the tooling to generate the TypeScript API client, and TypeScript validators for the generated models using `fp-ts`.
Readme
Approvio API
This repository contains the OpenAPI specification for the Approvio backend, the tooling to generate the TypeScript API client, and TypeScript validators for the generated models using fp-ts.
Project Structure
openapi.yaml: Main entry point for the OpenAPI 3.0 specification.openapi/: Directory containing split OpenAPI specification files referenced by the mainopenapi.yaml.src/: Source code directory.src/validators/: TypeScript validators for the generated OpenAPI models usingfp-ts/Either.src/utils/: Utility functions, including custom Jest matchers for testing validators.
test/: Test directory containing unit tests for the validators.generated/: Auto-generated output directory containing the TypeScript API client models and code.
Getting Started
Install Dependencies:
yarn installGenerate API Client:
This command will generate the TypeScript API client in the
generated/openapidirectory.yarn generate:api
Usage
The generated API client can be consumed by other TypeScript/JavaScript projects.
Linting the OpenAPI Specification
To lint the openapi.yaml file and check for adherence to best practices and defined rules:
yarn lint:apiLinking and Publishing
Linking for Local Development
To link this package for local development in another project (e.g., approvio-frontend):
Navigate to your consuming project (e.g.,
approvio-frontend):cd ../approvio-frontendLink the
approvio-apipackage:yarn link "<path-to-approvio-api>"
Now, your consuming project will use the locally linked version of @approvio/api.
Publishing to NPM
This package is automatically published to NPM when the version in package.json is incremented and merged into the main branch.
Automatic Publishing
The GitHub Workflow performs the following steps:
- Detects changes in the
mainbranch. - Compares the version in
package.jsonwith the latest version published on NPM. - If the version is newer, it builds the project and publishes it automatically.
Manual Publishing
If you need to publish manually:
- Ensure you are logged in to NPM:
npm login - Run the publish command:
npm publish --access public
