Skip to content

Commit

Permalink
feat: Removal of group.output in favour of group.name(no need to …
Browse files Browse the repository at this point in the history
…specify the output/root)
  • Loading branch information
stijnvanhulle committed Sep 29, 2024
1 parent aee3979 commit f70cb2b
Show file tree
Hide file tree
Showing 181 changed files with 2,928 additions and 2,192 deletions.
20 changes: 20 additions & 0 deletions .changeset/quiet-lemons-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
"@kubb/plugin-svelte-query": major
"@kubb/plugin-react-query": major
"@kubb/plugin-solid-query": major
"@kubb/plugin-vue-query": major
"@kubb/plugin-client": major
"@kubb/plugin-faker": major
"@kubb/plugin-redoc": major
"@kubb/plugin-msw": major
"@kubb/plugin-oas": major
"@kubb/plugin-swr": major
"@kubb/plugin-zod": major
"@kubb/plugin-ts": major
"@kubb/react": major
"@kubb/core": major
"@kubb/cli": major
"@kubb/fs": major
---

Removal of `group.output` in favour of `group.name`(no need to specify the output/root)
6 changes: 4 additions & 2 deletions docs/blog/v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import { pluginTanstackQuery } from '@kubb/plugin-tanstack-query'
- Removal of `output.exportType`
- Rename of `exportType` with `barrelType` for `output.barrelType` and every plugin
- Removal of `extName` in every plugin in favour of one `output.extension`
````
```
root: '.',
input: {
path: './petStore.yaml',
Expand All @@ -68,7 +68,9 @@ output: {
}
},
},
````
```
- Refactor of grouping(use of name instead of output) and output based on `output` of the current plugin


## Thanks

Expand Down
38 changes: 35 additions & 3 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,38 @@ title: Changelog

# Changelog

## 3.0.0-alpha.31
- [`plugin-client`](/plugins/client/): Generate `${tag}Service` controller file related to group x when using `group`(no need to specify `group.exportAs`)
- [`plugin-core`](/plugins/core/): Removal of `group.exportAs`
- [`plugin-core`](/plugins/core/): Removal of `group.output` in favour of `group.name`(no need to specify the output/root)
```typescript [kubb.config.ts]
import { defineConfig } from "@kubb/core"
import { pluginOas } from "@kubb/plugin-oas"
import { pluginTs } from "@kubb/plugin-ts"
import { pluginClient } from '@kubb/plugin-client'

export default defineConfig({
root: '.',
input: {
path: './petStore.yaml',
},
output: {
path: './src/gen',
clean: true,
},
plugins: [
pluginOas({ generators: [] }),
pluginClient({
output: {
path: './clients/axios',
},
group: { type: 'tag', output: './clients/axios/{{tag}}Service' }, // [!code --]
group: { type: 'tag', name: ({ group }) => `${group}Service` }, // [!code ++]
}),
],
})
```

## 3.0.0-alpha.30
- [`plugin-core`](/plugins/core/): Removal of `output.extName` in favour of `output.extension`
- [`plugin-core`](/plugins/core/): Removal of `exportType` in favour of `barrelType`
Expand Down Expand Up @@ -77,9 +109,9 @@ z.union([z.literal(true), z.literal(false)]) // [!code ++]
- Separate plugin/package for Solid-Query: `@kubb/plugin-solid-query`

```typescript twoslash [kubb.config.ts]
import {defineConfig} from "@kubb/core"
import {pluginOas} from "@kubb/plugin-oas"
import {pluginTs} from "@kubb/plugin-ts"
import { defineConfig } from "@kubb/core"
import { pluginOas } from "@kubb/plugin-oas"
import { pluginTs } from "@kubb/plugin-ts"
import { pluginSolidQuery } from '@kubb/plugin-solid-query' // [!code ++]
import { pluginTanstackQuery } from '@kubb/plugin-tanstack-query' // [!code --]
Expand Down
7 changes: 6 additions & 1 deletion e2e/kubb.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ const baseConfig = {
output: {
path: './clients/axios',
},
group: { type: 'tag', output: './clients/axios/{{tag}}Service' },
group: {
type: 'tag',
name({ group }) {
return `${group}Service`
},
},
}),
pluginZod({
output: {
Expand Down
2 changes: 1 addition & 1 deletion examples/advanced/configs/kubb.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export default defineConfig(() => {
pattern: 'store',
},
],
group: { type: 'tag', output: './clients/axios/{{tag}}Service' },
group: { type: 'tag', name: ({ group }) => `${group}Service` },
importPath: '../../../../axios-client.ts',
operations: true,
dataReturnType: 'full',
Expand Down
3 changes: 3 additions & 0 deletions examples/advanced/src/gen/clients/axios/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ export { deletePet } from './petService/deletePet.ts'
export { findPetsByStatus } from './petService/findPetsByStatus.ts'
export { findPetsByTags } from './petService/findPetsByTags.ts'
export { getPetById } from './petService/getPetById.ts'
export { petService } from './petService/petService.ts'
export { updatePet } from './petService/updatePet.ts'
export { updatePetWithForm } from './petService/updatePetWithForm.ts'
export { uploadFile } from './petService/uploadFile.ts'
export { createPets } from './petsService/createPets.ts'
export { petsService } from './petsService/petsService.ts'
export { createUser } from './userService/createUser.ts'
export { createUsersWithListInput } from './userService/createUsersWithListInput.ts'
export { deleteUser } from './userService/deleteUser.ts'
export { getUserByName } from './userService/getUserByName.ts'
export { loginUser } from './userService/loginUser.ts'
export { logoutUser } from './userService/logoutUser.ts'
export { updateUser } from './userService/updateUser.ts'
export { userService } from './userService/userService.ts'
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export { deletePet } from './deletePet.ts'
export { findPetsByStatus } from './findPetsByStatus.ts'
export { findPetsByTags } from './findPetsByTags.ts'
export { getPetById } from './getPetById.ts'
export { petService } from './petService.ts'
export { updatePet } from './updatePet.ts'
export { updatePetWithForm } from './updatePetWithForm.ts'
export { uploadFile } from './uploadFile.ts'
12 changes: 12 additions & 0 deletions examples/advanced/src/gen/clients/axios/petService/petService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { addPet } from './addPet.ts'
import { deletePet } from './deletePet.ts'
import { findPetsByStatus } from './findPetsByStatus.ts'
import { findPetsByTags } from './findPetsByTags.ts'
import { getPetById } from './getPetById.ts'
import { updatePet } from './updatePet.ts'
import { updatePetWithForm } from './updatePetWithForm.ts'
import { uploadFile } from './uploadFile.ts'

export function petService() {
return { updatePet, addPet, findPetsByStatus, findPetsByTags, getPetById, updatePetWithForm, deletePet, uploadFile }
}
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { createPets } from './createPets.ts'
export { petsService } from './petsService.ts'
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createPets } from './createPets.ts'

export function petsService() {
return { createPets }
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export { getUserByName } from './getUserByName.ts'
export { loginUser } from './loginUser.ts'
export { logoutUser } from './logoutUser.ts'
export { updateUser } from './updateUser.ts'
export { userService } from './userService.ts'
11 changes: 11 additions & 0 deletions examples/advanced/src/gen/clients/axios/userService/userService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { createUser } from './createUser.ts'
import { createUsersWithListInput } from './createUsersWithListInput.ts'
import { deleteUser } from './deleteUser.ts'
import { getUserByName } from './getUserByName.ts'
import { loginUser } from './loginUser.ts'
import { logoutUser } from './logoutUser.ts'
import { updateUser } from './updateUser.ts'

export function userService() {
return { createUser, createUsersWithListInput, loginUser, logoutUser, getUserByName, updateUser, deleteUser }
}
64 changes: 32 additions & 32 deletions examples/advanced/src/gen/clients/swr/index.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
export type { CreatePetsMutationKeySWR } from './petsSWRController/useCreatePetsSWR.ts'
export type { AddPetMutationKeySWR } from './petSWRController/useAddPetSWR.ts'
export type { DeletePetMutationKeySWR } from './petSWRController/useDeletePetSWR.ts'
export type { FindPetsByStatusQueryKeySWR } from './petSWRController/useFindPetsByStatusSWR.ts'
export type { FindPetsByTagsQueryKeySWR } from './petSWRController/useFindPetsByTagsSWR.ts'
export type { GetPetByIdQueryKeySWR } from './petSWRController/useGetPetByIdSWR.ts'
export type { UpdatePetMutationKeySWR } from './petSWRController/useUpdatePetSWR.ts'
export type { UpdatePetWithFormMutationKeySWR } from './petSWRController/useUpdatePetWithFormSWR.ts'
export type { UploadFileMutationKeySWR } from './petSWRController/useUploadFileSWR.ts'
export type { CreateUsersWithListInputMutationKeySWR } from './userSWRController/useCreateUsersWithListInputSWR.ts'
export type { CreateUserMutationKeySWR } from './userSWRController/useCreateUserSWR.ts'
export type { DeleteUserMutationKeySWR } from './userSWRController/useDeleteUserSWR.ts'
export type { GetUserByNameQueryKeySWR } from './userSWRController/useGetUserByNameSWR.ts'
export type { LoginUserQueryKeySWR } from './userSWRController/useLoginUserSWR.ts'
export type { LogoutUserQueryKeySWR } from './userSWRController/useLogoutUserSWR.ts'
export type { UpdateUserMutationKeySWR } from './userSWRController/useUpdateUserSWR.ts'
export { createPetsMutationKeySWR, useCreatePetsSWR } from './petsSWRController/useCreatePetsSWR.ts'
export { addPetMutationKeySWR, useAddPetSWR } from './petSWRController/useAddPetSWR.ts'
export { deletePetMutationKeySWR, useDeletePetSWR } from './petSWRController/useDeletePetSWR.ts'
export { findPetsByStatusQueryKeySWR, findPetsByStatusQueryOptionsSWR, useFindPetsByStatusSWR } from './petSWRController/useFindPetsByStatusSWR.ts'
export { findPetsByTagsQueryKeySWR, findPetsByTagsQueryOptionsSWR, useFindPetsByTagsSWR } from './petSWRController/useFindPetsByTagsSWR.ts'
export { getPetByIdQueryKeySWR, getPetByIdQueryOptionsSWR, useGetPetByIdSWR } from './petSWRController/useGetPetByIdSWR.ts'
export { updatePetMutationKeySWR, useUpdatePetSWR } from './petSWRController/useUpdatePetSWR.ts'
export { updatePetWithFormMutationKeySWR, useUpdatePetWithFormSWR } from './petSWRController/useUpdatePetWithFormSWR.ts'
export { uploadFileMutationKeySWR, useUploadFileSWR } from './petSWRController/useUploadFileSWR.ts'
export { createUsersWithListInputMutationKeySWR, useCreateUsersWithListInputSWR } from './userSWRController/useCreateUsersWithListInputSWR.ts'
export { createUserMutationKeySWR, useCreateUserSWR } from './userSWRController/useCreateUserSWR.ts'
export { deleteUserMutationKeySWR, useDeleteUserSWR } from './userSWRController/useDeleteUserSWR.ts'
export { getUserByNameQueryKeySWR, getUserByNameQueryOptionsSWR, useGetUserByNameSWR } from './userSWRController/useGetUserByNameSWR.ts'
export { loginUserQueryKeySWR, loginUserQueryOptionsSWR, useLoginUserSWR } from './userSWRController/useLoginUserSWR.ts'
export { logoutUserQueryKeySWR, logoutUserQueryOptionsSWR, useLogoutUserSWR } from './userSWRController/useLogoutUserSWR.ts'
export { updateUserMutationKeySWR, useUpdateUserSWR } from './userSWRController/useUpdateUserSWR.ts'
export type { AddPetMutationKeySWR } from './petController/useAddPetSWR.ts'
export type { DeletePetMutationKeySWR } from './petController/useDeletePetSWR.ts'
export type { FindPetsByStatusQueryKeySWR } from './petController/useFindPetsByStatusSWR.ts'
export type { FindPetsByTagsQueryKeySWR } from './petController/useFindPetsByTagsSWR.ts'
export type { GetPetByIdQueryKeySWR } from './petController/useGetPetByIdSWR.ts'
export type { UpdatePetMutationKeySWR } from './petController/useUpdatePetSWR.ts'
export type { UpdatePetWithFormMutationKeySWR } from './petController/useUpdatePetWithFormSWR.ts'
export type { UploadFileMutationKeySWR } from './petController/useUploadFileSWR.ts'
export type { CreatePetsMutationKeySWR } from './petsController/useCreatePetsSWR.ts'
export type { CreateUsersWithListInputMutationKeySWR } from './userController/useCreateUsersWithListInputSWR.ts'
export type { CreateUserMutationKeySWR } from './userController/useCreateUserSWR.ts'
export type { DeleteUserMutationKeySWR } from './userController/useDeleteUserSWR.ts'
export type { GetUserByNameQueryKeySWR } from './userController/useGetUserByNameSWR.ts'
export type { LoginUserQueryKeySWR } from './userController/useLoginUserSWR.ts'
export type { LogoutUserQueryKeySWR } from './userController/useLogoutUserSWR.ts'
export type { UpdateUserMutationKeySWR } from './userController/useUpdateUserSWR.ts'
export { addPetMutationKeySWR, useAddPetSWR } from './petController/useAddPetSWR.ts'
export { deletePetMutationKeySWR, useDeletePetSWR } from './petController/useDeletePetSWR.ts'
export { findPetsByStatusQueryKeySWR, findPetsByStatusQueryOptionsSWR, useFindPetsByStatusSWR } from './petController/useFindPetsByStatusSWR.ts'
export { findPetsByTagsQueryKeySWR, findPetsByTagsQueryOptionsSWR, useFindPetsByTagsSWR } from './petController/useFindPetsByTagsSWR.ts'
export { getPetByIdQueryKeySWR, getPetByIdQueryOptionsSWR, useGetPetByIdSWR } from './petController/useGetPetByIdSWR.ts'
export { updatePetMutationKeySWR, useUpdatePetSWR } from './petController/useUpdatePetSWR.ts'
export { updatePetWithFormMutationKeySWR, useUpdatePetWithFormSWR } from './petController/useUpdatePetWithFormSWR.ts'
export { uploadFileMutationKeySWR, useUploadFileSWR } from './petController/useUploadFileSWR.ts'
export { createPetsMutationKeySWR, useCreatePetsSWR } from './petsController/useCreatePetsSWR.ts'
export { createUsersWithListInputMutationKeySWR, useCreateUsersWithListInputSWR } from './userController/useCreateUsersWithListInputSWR.ts'
export { createUserMutationKeySWR, useCreateUserSWR } from './userController/useCreateUserSWR.ts'
export { deleteUserMutationKeySWR, useDeleteUserSWR } from './userController/useDeleteUserSWR.ts'
export { getUserByNameQueryKeySWR, getUserByNameQueryOptionsSWR, useGetUserByNameSWR } from './userController/useGetUserByNameSWR.ts'
export { loginUserQueryKeySWR, loginUserQueryOptionsSWR, useLoginUserSWR } from './userController/useLoginUserSWR.ts'
export { logoutUserQueryKeySWR, logoutUserQueryOptionsSWR, useLogoutUserSWR } from './userController/useLogoutUserSWR.ts'
export { updateUserMutationKeySWR, useUpdateUserSWR } from './userController/useUpdateUserSWR.ts'
Loading

0 comments on commit f70cb2b

Please sign in to comment.