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

Kubb v3 ideas #1115

Closed
36 tasks done
stijnvanhulle opened this issue Aug 10, 2024 — with Huly for GitHub · 11 comments
Closed
36 tasks done

Kubb v3 ideas #1115

stijnvanhulle opened this issue Aug 10, 2024 — with Huly for GitHub · 11 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

Copy link
Collaborator

stijnvanhulle commented Aug 10, 2024

I am already thinking about the next version of Kubb and what should be done to make it better:

https://rollupjs.org/plugin-development/#banner
https://unplugin.unjs.io/guide
https://coolify.io/docs/knowledge-base/faq

@stijnvanhulle stijnvanhulle added the enhancement New feature or request label Aug 10, 2024
@stijnvanhulle stijnvanhulle pinned this issue Aug 10, 2024
@stijnvanhulle stijnvanhulle self-assigned this Aug 10, 2024
@stijnvanhulle stijnvanhulle changed the title Kubb v3 ideas Kubb v4 ideas Aug 11, 2024
@stijnvanhulle stijnvanhulle changed the title Kubb v4 ideas Kubb v3 ideas Aug 11, 2024
@dir
Copy link

dir commented Aug 14, 2024

On your note of

"Use of the same naming for all plugins: @kubb/plugin-ts instead of @kubb/swagger-ts, prefix plugin is important here."

In a similar vein, I strongly feel that the use of "swagger" anywhere should be vaulted and replaced with openapi.

I know it seems small, but seeing swagger used instead of openapi gives off a strong "stuck in the past" vibe, for an otherwise such modern and forward thinking library.

@stijnvanhulle stijnvanhulle unpinned this issue Aug 15, 2024
@stijnvanhulle stijnvanhulle pinned this issue Aug 26, 2024
@stijnvanhulle stijnvanhulle added this to the 3.0.0 milestone Aug 27, 2024
@1saifj
Copy link

1saifj commented Aug 29, 2024

react-form-hook?

@joakimstrandell
Copy link

@stijnvanhulle Will it be possible to set the basePath for the client dynamically in v3? Would be a dealbreaker if you could set the basePath at runtime, not at generation.

@stijnvanhulle
Copy link
Collaborator Author

@joakimstrandell Today(in v2 and v3) you can use serverIndex to set the baseUrl: https://www.kubb.dev/plugins/plugin-oas/#serverindex. Other plugins like the @kubb/plugin-client and @kubb/plugin-react-query will use that config to set the baseURL, would that be enough or what do you mean with dynamically?

@joakimstrandell
Copy link

@stijnvanhulle I mean that I would like to set the path in the client during runtime, for example using some type of custom config. If I would use the server index I need to select the path when generating the client, if I understand the documentation correctly.

For example in hey-api you can set the base url like this:

import { client } from 'api';
import { config } from  'data' // custom

client.setConfig({
  baseUrl: config.api.basePath,
  headers: {
    Authorization: '...',
    'X-Csrftoken': '...',
  },
});

@stijnvanhulle
Copy link
Collaborator Author

@joakimstrandell I updated the default client to also have getConfig and setConfig but in Kubb you can also override the default client. This means you can do whatever you want so long you are following the guideline where the parameters are having the same shape as RequestConfig.

type RequestConfig<TData = unknown> = {
  baseURL?: string
  url?: string
  method: 'GET' | 'PUT' | 'PATCH' | 'POST' | 'DELETE' | 'OPTIONS'
  params?: unknown
  data?: TData | FormData
  responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'
  signal?: AbortSignal
  headers?: AxiosRequestConfig['headers']
}

@RabbitShare
Copy link

Transform snake_case to camelCase in generated code. Transform camelCase to snake_case before request

@stijnvanhulle
Copy link
Collaborator Author

@CHE1RON
Copy link
Contributor

CHE1RON commented Oct 29, 2024

I cannot find any resource (issue, discussion) on why asPascalConst is being deprecated .. ? 🤔

@stijnvanhulle
Copy link
Collaborator Author

@CHE1RON
Imagine you have the following enums being generated:

export const AddPetRequestStatusEnum = {
  available: 'available',
  pending: 'pending',
  sold: 'sold',
} as const
export type AddPetRequestStatusEnum = (typeof AddPetRequestStatusEnum)[keyof typeof AddPetRequestStatusEnum]

And having the following barrel file:

export type { AddPetRequestStatusEnum } from './AddPetRequest.js'
export { AddPetRequestStatusEnum } from './AddPetRequest.js'

This will throw some errors in TypeScript(Duplicate identifier) which also makes it not usable anymore, that was the reason behind making it deprecated and now with v3 removing it.

@stijnvanhulle
Copy link
Collaborator Author

Completing the migration guide before the v3 release: https://v3.kubb.dev/migration-guide. No additional features planned, only bug fixes until the release of v3.

@stijnvanhulle stijnvanhulle unpinned this issue Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants