Registry / testing / rapini

rapini

JSON →
library3.5.4jsnpmunverified

Rapini is a CLI code generator that produces React Query (v3/v4/v5), SWR hooks, Axios requests, and TypeScript types from OpenAPI specifications. Current stable version is 3.5.4 with monthly releases. It differentiates itself by packaging the generated code as a publishable npm package, supporting multiple React data-fetching libraries, and offering query key generation. Compatible with OpenAPI 3.0 and Swagger 2.0.

npm install rapini
INSTALL
IMPORT
SIG · RAPINI
R
rapini
testingjavascriptv3.5.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
npx rapini react-query v5 -p openapi.yaml
npm install -g rapini && rapini
Use npx for latest; CLI tool, not a library import.
useGeneratedQuery
import { useGeneratedQuery } from 'my-api-package'
import useGeneratedQuery from 'my-api-package'
Generated hooks are named exports; no default export in generated package.
generatedQueryKey
import { generatedQueryKey } from 'my-api-package'
const generatedQueryKey = require('my-api-package').generatedQueryKey
Generated package is ESM; use named import.

Generates a React Query v5 package from OpenAPI spec, then uses a typed hook in a React component to fetch data.

// 1. Generate an API package from an OpenAPI file npx rapini react-query v5 -p ./openapi.yaml -o ./my-api -n my-api // 2. In your React app, install the generated package and dependencies npm install ./my-api @tanstack/react-query axios // 3. Use the generated hooks import { useGetUsers } from 'my-api'; function Users() { const { data, isLoading } = useGetUsers(); if (isLoading) return <div>Loading...</div>; return <ul>{data?.map(u => <li key={u.id}>{u.name}</li>)}</ul>; }
Debug
Known issues
breakingGenerated package requires specific version of @tanstack/react-query or react-query.
fix
Ensure the matching version of React Query is installed (v3, v4, or v5).
affects: >=3.0.0
deprecatedReact Query V3 generation is deprecated in favor of TanStack Query v4/v5.
fix
Use `npx rapini react-query v5` instead of `npx rapini react-query` (which defaults to v3).
affects: <4.0.0
gotchaOpenAPI file must be valid; errors produce incomplete or broken generated code.
fix
Validate your OpenAPI spec with tools like swagger-cli before generation.
affects: all
gotchaGenerated package uses ESM only; CommonJS require() will fail.
fix
Import using ES module syntax in your project.
affects: >=3.0.0
Errors
Common errors & fixes
Cannot find module '@tanstack/react-query'
Missing peer dependency
fix
npm install @tanstack/react-query
Error: Could not parse OpenAPI file
Invalid YAML or JSON
fix
Fix the syntax of your openapi.yaml or openapi.json file
TypeError: rapini is not a recognized command
Using old npx cache or wrong command
fix
Ensure you are using `npx rapini` (lowercase) and clear npx cache: `npx clear-npx-cache`
Upgrade
Version history
3.5.4latest on npm
Audit
Dependencies
axiosrequiredGenerated HTTP client requests
@tanstack/react-queryoptionalRequired when generating react-query v4/v5 output
react-queryoptionalRequired when generating react-query v3 output
swroptionalRequired when generating swr output
Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
packagerapini
rapini — npm install rapini · libregistry