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

Open
33 of 37 tasks
stijnvanhulle opened this issue Aug 10, 2024 — with Huly for GitHub · 8 comments
Open
33 of 37 tasks

Kubb v3 ideas #1115

stijnvanhulle opened this issue Aug 10, 2024 — with Huly for GitHub · 8 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

@RabbitShare For that I suggest using https://github.com/thim81/openapi-format

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

5 participants