generated from stijnvanhulle/template
-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add useOperation and useOas with Oas and Oas.Operation component * chore: update examples * chore: refactor oas react logic * chore: operationgenerator cleanup * chore: operations for tanstack query * chore: update * fix: use of `useOperationHelpers` to abstract operation logic * chore: fix pluginManager mock * chore: linting * fix ts
- Loading branch information
1 parent
e2eed44
commit 752f9a0
Showing
99 changed files
with
1,432 additions
and
800 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
"@kubb/swagger-tanstack-query": patch | ||
"@kubb/swagger-client": patch | ||
"@kubb/swagger-zodios": patch | ||
"@kubb/swagger-faker": patch | ||
"@kubb/swagger-msw": patch | ||
"@kubb/swagger-swr": patch | ||
"@kubb/swagger-zod": patch | ||
"@kubb/swagger-ts": patch | ||
"@kubb/swagger": patch | ||
"@kubb/react": patch | ||
"@kubb/core": patch | ||
--- | ||
|
||
useOperation and useSchema with a component Oas and Oas.Operation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@kubb/swagger-zod": patch | ||
--- | ||
|
||
use of `useOperationHelpers` to abstract operation logic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
export function updatePet() { | ||
return '/pet' | ||
} | ||
export function addPet() { | ||
return '/pet' | ||
} | ||
export function findPetsByStatus() { | ||
return '/pet/findByStatus' | ||
} | ||
export function findPetsByTags() { | ||
return '/pet/findByTags' | ||
} | ||
export function getPetById() { | ||
return '/pet/{petId}' | ||
} | ||
export function updatePetWithForm() { | ||
return '/pet/{petId}' | ||
} | ||
export function deletePet() { | ||
return '/pet/{petId}' | ||
} | ||
export function uploadFile() { | ||
return '/pet/{petId}/uploadImage' | ||
} | ||
export function getInventory() { | ||
return '/store/inventory' | ||
} | ||
export function placeOrder() { | ||
return '/store/order' | ||
} | ||
export function placeOrderPatch() { | ||
return '/store/order' | ||
} | ||
export function getOrderById() { | ||
return '/store/order/{orderId}' | ||
} | ||
export function deleteOrder() { | ||
return '/store/order/{orderId}' | ||
} | ||
export function createUser() { | ||
return '/user' | ||
} | ||
export function createUsersWithListInput() { | ||
return '/user/createWithList' | ||
} | ||
export function loginUser() { | ||
return '/user/login' | ||
} | ||
export function logoutUser() { | ||
return '/user/logout' | ||
} | ||
export function getUserByName() { | ||
return '/user/{username}' | ||
} | ||
export function updateUser() { | ||
return '/user/{username}' | ||
} | ||
export function deleteUser() { | ||
return '/user/{username}' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export * from './models/index' | ||
export * from './hooks/index' | ||
export * from './models/index' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Editor, Function, File, useFile, usePlugin } from '@kubb/react' | ||
import { useOperations } from '@kubb/swagger/hooks' | ||
import { Operations } from '@kubb/swagger-tanstack-query/components' | ||
import React from 'react' | ||
import { FileMeta, PluginOptions } from '@kubb/swagger-tanstack-query' | ||
import { Operation } from '@kubb/swagger/oas' | ||
|
||
export const templates = { | ||
...Operations.templates, | ||
editor: function({ children }: React.ComponentProps<typeof Operations.templates.editor>) { | ||
const { key: pluginKey } = usePlugin<PluginOptions>() | ||
|
||
const file = useFile({ name: 'operations', extName: '.ts', pluginKey }) | ||
|
||
return ( | ||
<Editor language="typescript"> | ||
<File<FileMeta> | ||
baseName={file.baseName} | ||
path={file.path} | ||
meta={file.meta} | ||
> | ||
<File.Source> | ||
{children} | ||
</File.Source> | ||
</File> | ||
</Editor> | ||
) | ||
}, | ||
default: function({}: React.ComponentProps<typeof Operations.templates.default>) { | ||
const operations = useOperations() | ||
|
||
return ( | ||
<> | ||
{operations.map((item) => { | ||
return ( | ||
<Function name={item.getOperationId()} export> | ||
return {JSON.stringify(item.path)} | ||
</Function> | ||
) | ||
})} | ||
</> | ||
) | ||
}, | ||
} as const |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.