React Query
Install
info
This generator is a prerelease and may have breaking changes in future versions.
- npm
- yarn
- pnpm
npm install @basketry/react-query@alpha
yarn add @basketry/react-query@alpha
pnpm add @basketry/react-query@alpha
Basic Usage
basketry.config.json
{
"source": "petstore.json",
"parser": "@basketry/openapi-3",
"generators": ["@basketry/react-query"],
"output": "src"
}
File Structure
This generator will create React Query schemas for all the API schemas defined in the source file.
By default, the file will be nested within a directory named after the API major version. This behavior can be disabled by using the includeVersion
option from the Typescript Generator.
my-project/
├── node_modules/
├── src/
│ ├── v1/ <-- generated
│ │ └── hooks <-- generated
│ │ ├── pets.tsx <-- generated
│ │ ├── store.tsx <-- generated
│ │ └── users.tsx <-- generated
│ └── index.ts
├── .gitignore
├── basketry.config.json
├── package.json
├── petstore.json
└── README.md
Options
This generator depends on the @basketry/typescript
generator and all of their applied options will also apply to files emitted by this generator.
See:
@basketry/typescript
options
The @basketry/react-query
generator does not accept any of its own options.
Dependencies
The generated file contains code that depends on the @tanstack/react-query
package that is not included by default. You will need to install it separately.
- npm
- yarn
- pnpm
npm install @tanstack/react-query
yarn add @tanstack/react-query
pnpm add @tanstack/react-query