Skip to content

Commit

Permalink
Feat/barrel named (#713)
Browse files Browse the repository at this point in the history
* feat: `barrelNamed` for `exportType` to use `export { nameX, nameY } from '.'`

* chore: cleanup
  • Loading branch information
stijnvanhulle authored Dec 21, 2023
1 parent 5e90513 commit c22433e
Show file tree
Hide file tree
Showing 53 changed files with 583 additions and 199 deletions.
14 changes: 14 additions & 0 deletions .changeset/neat-doors-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"@kubb/swagger-tanstack-query": minor
"@kubb/swagger-client": minor
"@kubb/swagger-zodios": minor
"@kubb/swagger-faker": minor
"@kubb/swagger-msw": minor
"@kubb/swagger-swr": minor
"@kubb/swagger-zod": minor
"@kubb/swagger-ts": minor
"@kubb/parser": minor
"@kubb/core": minor
---

`barrelNamed` for `exportType` to use `export { nameX, nameY } from '.'`
2 changes: 1 addition & 1 deletion docs/plugins/swagger-client/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export default defineConfig({
Define what needs to exported, here you can also disable the export of barrel files

::: info
Type: `'barrel' | false` <br/>
Type: `'barrel' | 'barrelNamed' | false` <br/>

:::

Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/swagger-faker/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export default defineConfig({
Define what needs to be exported, here you can also disable the export of barrel files

::: info
Type: `'barrel' | false` <br/>
Type: `'barrel' | 'barrelNamed' | false` <br/>

:::

Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/swagger-msw/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export default defineConfig({
Define what needs to exported, here you can also disable the export of barrel files

::: info
Type: `'barrel' | false` <br/>
Type: `'barrel' | 'barrelNamed' | false` <br/>

:::

Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/swagger-swr/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export default defineConfig({
Define what needs to exported, here you can also disable the export of barrel files

::: info
Type: `'barrel' | false` <br/>
Type: `'barrel' | 'barrelNamed' | false` <br/>

:::

Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/swagger-tanstack-query/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export default defineConfig({
Define what needs to exported, here you can also disable the export of barrel files

::: info
Type: `'barrel' | false` <br/>
Type: `'barrel' | 'barrelNamed' | false` <br/>

:::

Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/swagger-ts/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export default defineConfig({
Define what needs to exported, here you can also disable the export of barrel files

::: info
Type: `'barrel' | false` <br/>
Type: `'barrel' | 'barrelNamed' | false` <br/>

:::

Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/swagger-zodios/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export default defineConfig({
Define what needs to exported, here you can also disable the export of barrel files

::: info
Type: `'barrel' | false` <br/>
Type: `'barrel' | 'barrelNamed' | false` <br/>

:::

Expand Down
12 changes: 6 additions & 6 deletions examples/advanced/src/gen/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export * as clients from './clients/axios'
export * as hooks from './clients/hooks'
export * as swrHooks from './clients/swr'
export * as faker from './mocks'
export * as clients from './clients/axios/index'
export * as hooks from './clients/hooks/index'
export * as swrHooks from './clients/swr/index'
export * as faker from './mocks/index'
export * from './models/ts/index.js'
export * as msw from './msw'
export * as zod from './zod'
export * as msw from './msw/index'
export * as zod from './zod/index'
4 changes: 2 additions & 2 deletions examples/client/src/gen/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './clients/axios'
export * from './models/ts'
export * from './clients/axios/index'
export * from './models/ts/index'
4 changes: 2 additions & 2 deletions examples/faker/src/gen/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './customMocks'
export * from './models'
export * from './customMocks/index'
export * from './models/index'
6 changes: 3 additions & 3 deletions examples/msw-v2/src/gen/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './mocks'
export * from './models'
export * from './msw'
export * from './mocks/index'
export * from './models/index'
export * from './msw/index'
4 changes: 2 additions & 2 deletions examples/msw/src/gen/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './models'
export * from './msw'
export * from './models/index'
export * from './msw/index'
3 changes: 3 additions & 0 deletions examples/msw/src/gen/mocks/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * as petMocks from './petMocks/index'
export * as storeMocks from './storeMocks/index'
export * as userMocks from './userMocks/index'
4 changes: 2 additions & 2 deletions examples/react-query-v5/src/gen/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './hooks'
export * from './models'
export * from './hooks/index'
export * from './models/index'
1 change: 1 addition & 0 deletions examples/react-query/kubb.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default defineConfig({
createSwaggerTS({
output: {
path: 'models',
exportType: 'barrelNamed',
},
}),
createSwaggerTanstackQuery({
Expand Down
110 changes: 108 additions & 2 deletions examples/react-query/src/gen/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,108 @@
export * from './hooks'
export * from './models'
export * from './hooks/index'
export type {
AddPet405,
AddPetMutation,
AddPetMutationRequest,
AddPetMutationResponse,
AddPetRequest,
AddPetRequestStatus,
Address,
ApiResponse,
Category,
CreateUserError,
CreateUserMutation,
CreateUserMutationRequest,
CreateUserMutationResponse,
CreateUsersWithListInputError,
CreateUsersWithListInputMutation,
CreateUsersWithListInputMutationRequest,
CreateUsersWithListInputMutationResponse,
Customer,
DeleteOrder400,
DeleteOrder404,
DeleteOrderMutation,
DeleteOrderMutationResponse,
DeleteOrderPathParams,
DeletePet400,
DeletePetHeaderParams,
DeletePetMutation,
DeletePetMutationResponse,
DeletePetPathParams,
DeleteUser400,
DeleteUser404,
DeleteUserMutation,
DeleteUserMutationResponse,
DeleteUserPathParams,
FindPetsByStatus400,
FindPetsByStatusQuery,
FindPetsByStatusQueryParams,
FindPetsByStatusQueryParamsStatus,
FindPetsByStatusQueryResponse,
FindPetsByTags400,
FindPetsByTagsQuery,
FindPetsByTagsQueryParams,
FindPetsByTagsQueryResponse,
GetInventoryQuery,
GetInventoryQueryResponse,
GetOrderById400,
GetOrderById404,
GetOrderByIdPathParams,
GetOrderByIdQuery,
GetOrderByIdQueryResponse,
GetPetById400,
GetPetById404,
GetPetByIdPathParams,
GetPetByIdQuery,
GetPetByIdQueryResponse,
GetUserByName400,
GetUserByName404,
GetUserByNamePathParams,
GetUserByNameQuery,
GetUserByNameQueryResponse,
LoginUser400,
LoginUserQuery,
LoginUserQueryParams,
LoginUserQueryResponse,
LogoutUserError,
LogoutUserQuery,
LogoutUserQueryResponse,
Order,
OrderHttpStatus,
OrderStatus,
Pet,
PetNotFound,
PetStatus,
PlaceOrder405,
PlaceOrderMutation,
PlaceOrderMutationRequest,
PlaceOrderMutationResponse,
PlaceOrderPatch405,
PlaceOrderPatchMutation,
PlaceOrderPatchMutationRequest,
PlaceOrderPatchMutationResponse,
Tag,
UpdatePet400,
UpdatePet404,
UpdatePet405,
UpdatePetMutation,
UpdatePetMutationRequest,
UpdatePetMutationResponse,
UpdatePetWithForm405,
UpdatePetWithFormMutation,
UpdatePetWithFormMutationResponse,
UpdatePetWithFormPathParams,
UpdatePetWithFormQueryParams,
UpdateUserError,
UpdateUserMutation,
UpdateUserMutationRequest,
UpdateUserMutationResponse,
UpdateUserPathParams,
UploadFileMutation,
UploadFileMutationRequest,
UploadFileMutationResponse,
UploadFilePathParams,
UploadFileQueryParams,
User,
UserArray,
} from './models/index'
export { addPetRequestStatus, findPetsByStatusQueryParamsStatus, orderHttpStatus, orderStatus, petStatus } from './models/index'
83 changes: 52 additions & 31 deletions examples/react-query/src/gen/models/index.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,52 @@
export * from './AddPet'
export * from './AddPetRequest'
export * from './Address'
export * from './ApiResponse'
export * from './Category'
export * from './CreateUser'
export * from './CreateUsersWithListInput'
export * from './Customer'
export * from './DeleteOrder'
export * from './DeletePet'
export * from './DeleteUser'
export * from './FindPetsByStatus'
export * from './FindPetsByTags'
export * from './GetInventory'
export * from './GetOrderById'
export * from './GetPetById'
export * from './GetUserByName'
export * from './LoginUser'
export * from './LogoutUser'
export * from './Order'
export * from './Pet'
export * from './PetNotFound'
export * from './PlaceOrder'
export * from './PlaceOrderPatch'
export * from './Tag'
export * from './UpdatePet'
export * from './UpdatePetWithForm'
export * from './UpdateUser'
export * from './UploadFile'
export * from './User'
export * from './UserArray'
export type { AddPet405, AddPetMutation, AddPetMutationRequest, AddPetMutationResponse } from './AddPet'
export type { AddPetRequest, AddPetRequestStatus } from './AddPetRequest'
export { addPetRequestStatus } from './AddPetRequest'
export type { Address } from './Address'
export type { ApiResponse } from './ApiResponse'
export type { Category } from './Category'
export type { CreateUserError, CreateUserMutation, CreateUserMutationRequest, CreateUserMutationResponse } from './CreateUser'
export type {
CreateUsersWithListInputError,
CreateUsersWithListInputMutation,
CreateUsersWithListInputMutationRequest,
CreateUsersWithListInputMutationResponse,
} from './CreateUsersWithListInput'
export type { Customer } from './Customer'
export type { DeleteOrder400, DeleteOrder404, DeleteOrderMutation, DeleteOrderMutationResponse, DeleteOrderPathParams } from './DeleteOrder'
export type { DeletePet400, DeletePetHeaderParams, DeletePetMutation, DeletePetMutationResponse, DeletePetPathParams } from './DeletePet'
export type { DeleteUser400, DeleteUser404, DeleteUserMutation, DeleteUserMutationResponse, DeleteUserPathParams } from './DeleteUser'
export type {
FindPetsByStatus400,
FindPetsByStatusQuery,
FindPetsByStatusQueryParams,
FindPetsByStatusQueryParamsStatus,
FindPetsByStatusQueryResponse,
} from './FindPetsByStatus'
export { findPetsByStatusQueryParamsStatus } from './FindPetsByStatus'
export type { FindPetsByTags400, FindPetsByTagsQuery, FindPetsByTagsQueryParams, FindPetsByTagsQueryResponse } from './FindPetsByTags'
export type { GetInventoryQuery, GetInventoryQueryResponse } from './GetInventory'
export type { GetOrderById400, GetOrderById404, GetOrderByIdPathParams, GetOrderByIdQuery, GetOrderByIdQueryResponse } from './GetOrderById'
export type { GetPetById400, GetPetById404, GetPetByIdPathParams, GetPetByIdQuery, GetPetByIdQueryResponse } from './GetPetById'
export type { GetUserByName400, GetUserByName404, GetUserByNamePathParams, GetUserByNameQuery, GetUserByNameQueryResponse } from './GetUserByName'
export type { LoginUser400, LoginUserQuery, LoginUserQueryParams, LoginUserQueryResponse } from './LoginUser'
export type { LogoutUserError, LogoutUserQuery, LogoutUserQueryResponse } from './LogoutUser'
export type { Order, OrderHttpStatus, OrderStatus } from './Order'
export { orderHttpStatus, orderStatus } from './Order'
export type { Pet, PetStatus } from './Pet'
export { petStatus } from './Pet'
export type { PetNotFound } from './PetNotFound'
export type { PlaceOrder405, PlaceOrderMutation, PlaceOrderMutationRequest, PlaceOrderMutationResponse } from './PlaceOrder'
export type { PlaceOrderPatch405, PlaceOrderPatchMutation, PlaceOrderPatchMutationRequest, PlaceOrderPatchMutationResponse } from './PlaceOrderPatch'
export type { Tag } from './Tag'
export type { UpdatePet400, UpdatePet404, UpdatePet405, UpdatePetMutation, UpdatePetMutationRequest, UpdatePetMutationResponse } from './UpdatePet'
export type {
UpdatePetWithForm405,
UpdatePetWithFormMutation,
UpdatePetWithFormMutationResponse,
UpdatePetWithFormPathParams,
UpdatePetWithFormQueryParams,
} from './UpdatePetWithForm'
export type { UpdateUserError, UpdateUserMutation, UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from './UpdateUser'
export type { UploadFileMutation, UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from './UploadFile'
export type { User } from './User'
export type { UserArray } from './UserArray'
4 changes: 2 additions & 2 deletions examples/solid-query/src/gen/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './hooks'
export * from './models'
export * from './hooks/index'
export * from './models/index'
4 changes: 2 additions & 2 deletions examples/svelte-query/src/gen/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './hooks'
export * from './models'
export * from './hooks/index'
export * from './models/index'
4 changes: 2 additions & 2 deletions examples/swr/src/gen/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './hooks'
export * from './models'
export * from './hooks/index'
export * from './models/index'
3 changes: 2 additions & 1 deletion examples/typescript/kubb.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default defineConfig({
createSwaggerTS({
output: {
path: 'models.ts',
exportAs: 'models',
},
enumType: 'enum',
}),
Expand All @@ -32,7 +33,7 @@ export default defineConfig({
createSwaggerTS({
output: {
path: 'ts/models',
exportAs: 'models',
exportType: 'barrelNamed',
},
oasType: 'infer',
}),
Expand Down
Loading

1 comment on commit c22433e

@vercel
Copy link

@vercel vercel bot commented on c22433e Dec 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

kubb – ./

kubb.dev
kubb-kubb.vercel.app
www.kubb.dev
kubb-git-main-kubb.vercel.app

Please sign in to comment.