Skip to content

Commit

Permalink
chore(openApi): configured rtk-OpenApi codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
Koufan-De-King committed Jul 22, 2024
1 parent 69f0704 commit 13aaa96
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ docs/gen
*.njsproj
*.sln
*.sw?

#API codegen files
./src/store/LynxScannerApi.ts
12 changes: 12 additions & 0 deletions openapi-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { ConfigFile } from '@rtk-query/codegen-openapi'

const config: ConfigFile = {
schemaFile: './openapi.yaml',
apiFile: './src/store/emptyApi.ts',
apiImport: 'emptySplitApi',
outputFile: './src/store/LynxScannerApi.ts',
exportName: 'LynxScannerApi',
hooks: true,
}

export default config
8 changes: 8 additions & 0 deletions src/store/emptyApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Or from '@reduxjs/toolkit/query' if not using the auto-generated hooks
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'

Check failure on line 2 in src/store/emptyApi.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Cannot find module '@reduxjs/toolkit/query/react' or its corresponding type declarations.

Check failure on line 2 in src/store/emptyApi.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Cannot find module '@reduxjs/toolkit/query/react' or its corresponding type declarations.

// initialize an empty api service that we'll inject endpoints into later as needed
export const emptySplitApi = createApi({
baseQuery: fetchBaseQuery({ baseUrl: '/' }),
endpoints: () => ({})
})

0 comments on commit 13aaa96

Please sign in to comment.