@@ -28,7 +28,7 @@ We provide a package for RTK Query code generation from OpenAPI schemas. It is p
28
28
29
29
Create an empty api using ` createApi ` like
30
30
31
- ``` ts
31
+ ``` ts no-transpile
32
32
// Or from '@reduxjs/toolkit/query' if not using the auto-generated hooks
33
33
import { createApi , fetchBaseQuery } from ' @reduxjs/toolkit/query/react'
34
34
@@ -41,8 +41,8 @@ export const emptySplitApi = createApi({
41
41
42
42
Generate a config file (json, js or ts) with contents like
43
43
44
- ``` ts
45
- import { ConfigFile } from ' @rtk-incubator/rtk- query- codegen-openapi'
44
+ ``` ts no-transpile
45
+ import { ConfigFile } from ' @rtk-query/ codegen-openapi'
46
46
47
47
const config: ConfigFile = {
48
48
schemaFile: ' https://petstore3.swagger.io/api/v3/openapi.json' ,
@@ -64,7 +64,7 @@ npx @rtk-query/codegen-openapi openapi-config.ts
64
64
65
65
### Programmatic usage
66
66
67
- ``` ts
67
+ ``` ts no-transpile
68
68
import { generateEndpoints } from ' @rtk-query/codegen-openapi'
69
69
70
70
const api = await generateEndpoints ({
@@ -79,7 +79,7 @@ const api = await generateEndpoints({
79
79
80
80
#### Simple usage
81
81
82
- ``` ts
82
+ ``` ts no-transpile
83
83
interface SimpleUsage {
84
84
apiFile: string
85
85
schemaFile: string
@@ -107,7 +107,7 @@ export type EndpointMatcherFunction = (
107
107
108
108
If you only want to include a few endpoints, you can use the ` filterEndpoints ` config option to filter your endpoints.
109
109
110
- ` ` ` ts
110
+ ` ` ` ts no - transpile
111
111
const filteredConfig: ConfigFile = {
112
112
// ...
113
113
// should only have endpoints loginUser, placeOrder, getOrderById, deleteOrder
@@ -119,7 +119,7 @@ const filteredConfig: ConfigFile = {
119
119
120
120
If an endpoint is generated as a mutation instead of a query or the other way round, you can override that:
121
121
122
- ``` ts
122
+ ``` ts no-transpile
123
123
const withOverride: ConfigFile = {
124
124
// ...
125
125
endpointOverrides: [
@@ -133,7 +133,7 @@ const withOverride: ConfigFile = {
133
133
134
134
#### Multiple output files
135
135
136
- ``` ts
136
+ ``` ts no-transpile
137
137
const config: ConfigFile = {
138
138
schemaFile: ' https://petstore3.swagger.io/api/v3/openapi.json' ,
139
139
apiFile: ' ./src/store/emptyApi.ts' ,
0 commit comments