@approvio/api
v0.0.39
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
To publish this package to an NPM registry:
Ensure you are logged in to the correct NPM registry:
yarn loginRun
yarn publish:yarn publish --access public
If you get an error like
error Couldn't publish package: "https://registry.yarnpkg.com/@approvio%2fapi: Not found", try runningnpm loginfirst.
