Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More elaborate tests on const keyword #583

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ test.json
.next
docs/.vitepress/cache/**
docs/.vitepress/dist/**

.idea/
30 changes: 15 additions & 15 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"packages/kubb": "1.14.6",
"packages/core": "1.14.6",
"packages/cli": "1.14.6",
"packages/parser": "1.14.6",
"packages/swagger": "1.14.6",
"packages/swagger-ts": "1.14.6",
"packages/swagger-client": "1.14.6",
"packages/swagger-tanstack-query": "1.14.6",
"packages/swagger-swr": "1.14.6",
"packages/swagger-zod": "1.14.6",
"packages/swagger-zodios": "1.14.6",
"packages/swagger-faker": "1.14.6",
"packages/swagger-msw": "1.14.6",
"packages/react": "1.14.6",
".": "1.14.6"
"packages/kubb": "1.14.9",
"packages/core": "1.14.9",
"packages/cli": "1.14.9",
"packages/parser": "1.14.9",
"packages/swagger": "1.14.9",
"packages/swagger-ts": "1.14.9",
"packages/swagger-client": "1.14.9",
"packages/swagger-tanstack-query": "1.14.9",
"packages/swagger-swr": "1.14.9",
"packages/swagger-zod": "1.14.9",
"packages/swagger-zodios": "1.14.9",
"packages/swagger-faker": "1.14.9",
"packages/swagger-msw": "1.14.9",
"packages/react": "1.14.9",
".": "1.14.9"
}
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@
# Changelog
## [1.14.9](https://github.com/kubb-project/kubb/compare/kubb-v1.14.8...kubb-v1.14.9) (2023-11-12)


### 🐞 Bug Fixes

* use of baseURL for Zodios ([#631](https://github.com/kubb-project/kubb/issues/631)) ([f5dbd2f](https://github.com/kubb-project/kubb/commit/f5dbd2f5ab301d9620a823b6fb35fbb1acfa256f))

## [1.14.8](https://github.com/kubb-project/kubb/compare/kubb-v1.14.7...kubb-v1.14.8) (2023-11-09)


### 🐞 Bug Fixes

* strict type for swagger-client ([eacdd8c](https://github.com/kubb-project/kubb/commit/eacdd8c4ccf316bb75777a6386f31828489d48b5))

## [1.14.7](https://github.com/kubb-project/kubb/compare/kubb-v1.14.6...kubb-v1.14.7) (2023-11-08)


### 📚 Documentation

* add alpha docs ([ec726d7](https://github.com/kubb-project/kubb/commit/ec726d79f2dbe2823ad3f532e378a1a174e74d24))
* fix install command for swagger-tanstack-query plugin ([216390f](https://github.com/kubb-project/kubb/commit/216390fd47c60aecf04e562e385715147ba97a38))


### 🐞 Bug Fixes

* upgrade js-runtime ([70785bd](https://github.com/kubb-project/kubb/commit/70785bdaa1cb3e35a9511b73b0772de644eecd39))

## [1.14.6](https://github.com/kubb-project/kubb/compare/kubb-v1.14.5...kubb-v1.14.6) (2023-10-27)


Expand Down
8 changes: 4 additions & 4 deletions docs/plugins/swagger-tanstack-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ With the Swagger Tanstack Query plugin you can create:
::: code-group

```shell [bun <img src="/feature/bun.svg"/>]
bun add @kubb/swagger-tanstack-query @kubb/swagger-ts @kubb swagger
bun add @kubb/swagger-tanstack-query @kubb/swagger-ts @kubb/swagger
```

```shell [pnpm <img src="/feature/pnpm.svg"/>]
pnpm add @kubb/swagger-tanstack-query @kubb/swagger-ts @kubb swagger
pnpm add @kubb/swagger-tanstack-query @kubb/swagger-ts @kubb/swagger
```

```shell [npm <img src="/feature/npm.svg"/>]
npm install @kubb/swagger-tanstack-query @kubb/swagger-ts @kubb swagger
npm install @kubb/swagger-tanstack-query @kubb/swagger-ts @kubb/swagger
```

```shell [yarn <img src="/feature/yarn.svg"/>]
yarn add @kubb/swagger-tanstack-query @kubb/swagger-ts @kubb swagger
yarn add @kubb/swagger-tanstack-query @kubb/swagger-ts @kubb/swagger
```

:::
Expand Down
8 changes: 4 additions & 4 deletions examples/advanced/src/gen/clients/axios/petService/addPet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import type { AddPetMutationRequest, AddPetMutationResponse } from '../../../mod
* @summary Add a new pet to the store
* @link /pet
*/
export async function addPet<TData = AddPetMutationResponse, TVariables = AddPetMutationRequest>(
data: TVariables,
export async function addPet(
data: AddPetMutationRequest,
options: Partial<Parameters<typeof client>[0]> = {},
): Promise<ResponseConfig<TData>> {
return client<TData, TVariables>({
): Promise<ResponseConfig<AddPetMutationResponse>> {
return client<AddPetMutationResponse, AddPetMutationRequest>({
method: 'post',
url: `/pet`,
data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderPar
* @summary Deletes a pet
* @link /pet/:petId
*/
export async function deletePet<TData = DeletePetMutationResponse>(
export async function deletePet(
{ petId }: DeletePetPathParams,
headers?: DeletePetHeaderParams,
options: Partial<Parameters<typeof client>[0]> = {},
): Promise<ResponseConfig<TData>> {
return client<TData>({
): Promise<ResponseConfig<DeletePetMutationResponse>> {
return client<DeletePetMutationResponse>({
method: 'delete',
url: `/pet/${petId}`,
headers: { ...headers, ...options.headers },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams } from
* @summary Finds Pets by status
* @link /pet/findByStatus
*/
export async function findPetsByStatus<TData = FindPetsByStatusQueryResponse>(
export async function findPetsByStatus(
params?: FindPetsByStatusQueryParams,
options: Partial<Parameters<typeof client>[0]> = {},
): Promise<ResponseConfig<TData>> {
return client<TData>({
): Promise<ResponseConfig<FindPetsByStatusQueryResponse>> {
return client<FindPetsByStatusQueryResponse>({
method: 'get',
url: `/pet/findByStatus`,
params,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsBy
* @summary Finds Pets by tags
* @link /pet/findByTags
*/
export async function findPetsByTags<TData = FindPetsByTagsQueryResponse>(
export async function findPetsByTags(
headers: FindPetsByTagsHeaderParams,
params?: FindPetsByTagsQueryParams,
options: Partial<Parameters<typeof client>[0]> = {},
): Promise<ResponseConfig<TData>> {
return client<TData>({
): Promise<ResponseConfig<FindPetsByTagsQueryResponse>> {
return client<FindPetsByTagsQueryResponse>({
method: 'get',
url: `/pet/findByTags`,
params,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import type { GetPetByIdQueryResponse, GetPetByIdPathParams } from '../../../mod
* @summary Find pet by ID
* @link /pet/:petId
*/
export async function getPetById<TData = GetPetByIdQueryResponse>(
export async function getPetById(
{ petId }: GetPetByIdPathParams,
options: Partial<Parameters<typeof client>[0]> = {},
): Promise<ResponseConfig<TData>> {
return client<TData>({
): Promise<ResponseConfig<GetPetByIdQueryResponse>> {
return client<GetPetByIdQueryResponse>({
method: 'get',
url: `/pet/${petId}`,
...options,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import type { UpdatePetMutationRequest, UpdatePetMutationResponse } from '../../
* @summary Update an existing pet
* @link /pet
*/
export async function updatePet<TData = UpdatePetMutationResponse, TVariables = UpdatePetMutationRequest>(
data: TVariables,
export async function updatePet(
data: UpdatePetMutationRequest,
options: Partial<Parameters<typeof client>[0]> = {},
): Promise<ResponseConfig<TData>> {
return client<TData, TVariables>({
): Promise<ResponseConfig<UpdatePetMutationResponse>> {
return client<UpdatePetMutationResponse, UpdatePetMutationRequest>({
method: 'put',
url: `/pet`,
data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import type {
* @summary Updates a pet in the store with form data
* @link /pet/:petId
*/
export async function updatePetWithForm<TData = UpdatePetWithFormMutationResponse>(
export async function updatePetWithForm(
{ petId }: UpdatePetWithFormPathParams,
params?: UpdatePetWithFormQueryParams,
options: Partial<Parameters<typeof client>[0]> = {},
): Promise<ResponseConfig<TData>> {
return client<TData>({
): Promise<ResponseConfig<UpdatePetWithFormMutationResponse>> {
return client<UpdatePetWithFormMutationResponse>({
method: 'post',
url: `/pet/${petId}`,
params,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import type {
* @summary uploads an image
* @link /pet/:petId/uploadImage
*/
export async function uploadFile<TData = UploadFileMutationResponse, TVariables = UploadFileMutationRequest>(
export async function uploadFile(
{ petId }: UploadFilePathParams,
data?: TVariables,
data?: UploadFileMutationRequest,
params?: UploadFileQueryParams,
options: Partial<Parameters<typeof client>[0]> = {},
): Promise<ResponseConfig<TData>> {
return client<TData, TVariables>({
): Promise<ResponseConfig<UploadFileMutationResponse>> {
return client<UploadFileMutationResponse, UploadFileMutationRequest>({
method: 'post',
url: `/pet/${petId}/uploadImage`,
params,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import type {
* @summary Create a pet
* @link /pets/:uuid
*/
export async function createPets<TData = CreatePetsMutationResponse, TVariables = CreatePetsMutationRequest>(
export async function createPets(
{ uuid }: CreatePetsPathParams,
data: TVariables,
data: CreatePetsMutationRequest,
headers: CreatePetsHeaderParams,
params?: CreatePetsQueryParams,
options: Partial<Parameters<typeof client>[0]> = {},
): Promise<ResponseConfig<TData>> {
return client<TData, TVariables>({
): Promise<ResponseConfig<CreatePetsMutationResponse>> {
return client<CreatePetsMutationResponse, CreatePetsMutationRequest>({
method: 'post',
url: `/pets/${uuid}`,
params,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../.
* @summary Create user
* @link /user
*/
export async function createUser<TData = CreateUserMutationResponse, TVariables = CreateUserMutationRequest>(
data?: TVariables,
export async function createUser(
data?: CreateUserMutationRequest,
options: Partial<Parameters<typeof client>[0]> = {},
): Promise<ResponseConfig<TData>> {
return client<TData, TVariables>({
): Promise<ResponseConfig<CreateUserMutationResponse>> {
return client<CreateUserMutationResponse, CreateUserMutationRequest>({
method: 'post',
url: `/user`,
data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import type {
* @summary Creates list of users with given input array
* @link /user/createWithList
*/
export async function createUsersWithListInput<TData = CreateUsersWithListInputMutationResponse, TVariables = CreateUsersWithListInputMutationRequest>(
data?: TVariables,
export async function createUsersWithListInput(
data?: CreateUsersWithListInputMutationRequest,
options: Partial<Parameters<typeof client>[0]> = {},
): Promise<ResponseConfig<TData>> {
return client<TData, TVariables>({
): Promise<ResponseConfig<CreateUsersWithListInputMutationResponse>> {
return client<CreateUsersWithListInputMutationResponse, CreateUsersWithListInputMutationRequest>({
method: 'post',
url: `/user/createWithList`,
data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import type { DeleteUserMutationResponse, DeleteUserPathParams } from '../../../
* @summary Delete user
* @link /user/:username
*/
export async function deleteUser<TData = DeleteUserMutationResponse>(
export async function deleteUser(
{ username }: DeleteUserPathParams,
options: Partial<Parameters<typeof client>[0]> = {},
): Promise<ResponseConfig<TData>> {
return client<TData>({
): Promise<ResponseConfig<DeleteUserMutationResponse>> {
return client<DeleteUserMutationResponse>({
method: 'delete',
url: `/user/${username}`,
...options,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import type { GetUserByNameQueryResponse, GetUserByNamePathParams } from '../../
* @summary Get user by user name
* @link /user/:username
*/
export async function getUserByName<TData = GetUserByNameQueryResponse>(
export async function getUserByName(
{ username }: GetUserByNamePathParams,
options: Partial<Parameters<typeof client>[0]> = {},
): Promise<ResponseConfig<TData>> {
return client<TData>({
): Promise<ResponseConfig<GetUserByNameQueryResponse>> {
return client<GetUserByNameQueryResponse>({
method: 'get',
url: `/user/${username}`,
...options,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import type { LoginUserQueryResponse, LoginUserQueryParams } from '../../../mode
* @summary Logs user into the system
* @link /user/login
*/
export async function loginUser<TData = LoginUserQueryResponse>(
export async function loginUser(
params?: LoginUserQueryParams,
options: Partial<Parameters<typeof client>[0]> = {},
): Promise<ResponseConfig<TData>> {
return client<TData>({
): Promise<ResponseConfig<LoginUserQueryResponse>> {
return client<LoginUserQueryResponse>({
method: 'get',
url: `/user/login`,
params,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type { LogoutUserQueryResponse } from '../../../models/ts/userController/
* @summary Logs out current logged in user session
* @link /user/logout
*/
export async function logoutUser<TData = LogoutUserQueryResponse>(options: Partial<Parameters<typeof client>[0]> = {}): Promise<ResponseConfig<TData>> {
return client<TData>({
export async function logoutUser(options: Partial<Parameters<typeof client>[0]> = {}): Promise<ResponseConfig<LogoutUserQueryResponse>> {
return client<LogoutUserQueryResponse>({
method: 'get',
url: `/user/logout`,
...options,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserP
* @summary Update user
* @link /user/:username
*/
export async function updateUser<TData = UpdateUserMutationResponse, TVariables = UpdateUserMutationRequest>(
export async function updateUser(
{ username }: UpdateUserPathParams,
data?: TVariables,
data?: UpdateUserMutationRequest,
options: Partial<Parameters<typeof client>[0]> = {},
): Promise<ResponseConfig<TData>> {
return client<TData, TVariables>({
): Promise<ResponseConfig<UpdateUserMutationResponse>> {
return client<UpdateUserMutationResponse, UpdateUserMutationRequest>({
method: 'put',
url: `/user/${username}`,
data,
Expand Down
2 changes: 1 addition & 1 deletion examples/advanced/src/gen/zodios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,6 @@ const endpoints = makeApi([
},
])

export const api = new Zodios(endpoints)
export const api = new Zodios('https://petstore3.swagger.io/api/v3', endpoints)

export default api
8 changes: 4 additions & 4 deletions examples/client/src/gen/clients/axios/petService/addPet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import type { AddPetMutationRequest, AddPetMutationResponse } from '../../../mod
* @summary Add a new pet to the store
* @link /pet
*/
export async function addPet<TData = AddPetMutationResponse, TVariables = AddPetMutationRequest>(
data: TVariables,
export async function addPet(
data: AddPetMutationRequest,
options: Partial<Parameters<typeof client>[0]> = {},
): Promise<ResponseConfig<TData>['data']> {
const { data: resData } = await client<TData, TVariables>({
): Promise<ResponseConfig<AddPetMutationResponse>['data']> {
const { data: resData } = await client<AddPetMutationResponse, AddPetMutationRequest>({
method: 'post',
url: `/pet`,
data,
Expand Down
6 changes: 3 additions & 3 deletions examples/client/src/gen/clients/axios/petService/deletePet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderPar
* @summary Deletes a pet
* @link /pet/:petId
*/
export async function deletePet<TData = DeletePetMutationResponse>(
export async function deletePet(
petId: DeletePetPathParams['petId'],
headers?: DeletePetHeaderParams,
options: Partial<Parameters<typeof client>[0]> = {},
): Promise<ResponseConfig<TData>['data']> {
const { data: resData } = await client<TData>({
): Promise<ResponseConfig<DeletePetMutationResponse>['data']> {
const { data: resData } = await client<DeletePetMutationResponse>({
method: 'delete',
url: `/pet/${petId}`,
headers: { ...headers, ...options.headers },
Expand Down
Loading
Loading