@kubb/plugin-fetch 5.5.10 → 5.5.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1487,7 +1487,7 @@ var compatibility = {
1487
1487
  };
1488
1488
  //#endregion
1489
1489
  //#region package.json
1490
- var version = "5.5.10";
1490
+ var version = "5.5.11";
1491
1491
  //#endregion
1492
1492
  //#region src/templates.ts
1493
1493
  /** Absolute path to the fetch client template, copied into `.kubb/client.ts`. */
package/dist/index.js CHANGED
@@ -1461,7 +1461,7 @@ var compatibility = {
1461
1461
  };
1462
1462
  //#endregion
1463
1463
  //#region package.json
1464
- var version = "5.5.10";
1464
+ var version = "5.5.11";
1465
1465
  //#endregion
1466
1466
  //#region src/templates.ts
1467
1467
  /** Absolute path to the fetch client template, copied into `.kubb/client.ts`. */
package/docs/options.md CHANGED
@@ -11,7 +11,6 @@ Pass these options to `pluginFetch()`. Shared options link to [Shared plugin opt
11
11
  | [`baseURL`](#baseurl) | Base URL prepended to every request. | None |
12
12
  | [`throwOnErrorDefault`](#throwonerrordefault) | Default error behavior and return type for generated operations. | `true` |
13
13
  | [`validator`](#validator) | Validate request and response bodies with Zod. | `false` |
14
- | [`comments`](#comments) | How much of each description reaches the JSDoc. | `'full'` |
15
14
  | [`sdk`](#sdk) | Generate a class-based SDK instead of functions. | None |
16
15
  | [`returnType`](#returntype) | Shape of the value a generated call resolves to. | `'full'` |
17
16
  | [`include`](https://kubb.dev/docs/5.x/reference/plugin-options#include) | Keep only operations that match. | None |
@@ -90,32 +89,6 @@ export default defineConfig({
90
89
  })
91
90
  ```
92
91
 
93
- ### comments
94
-
95
- Controls generated JSDoc.
96
-
97
- | | |
98
- | -------- | ----------------------------- |
99
- | Type | `'full' \| 'brief' \| 'none'` |
100
- | Required | `false` |
101
- | Default | `'full'` |
102
-
103
- ::field-group
104
-
105
- :::field{name="'full'"}
106
- Default value. Keeps complete descriptions and tags.
107
- :::
108
-
109
- :::field{name="'brief'"}
110
- Keeps the first sentence and other tags. Descriptions over 150 characters without a sentence ending are cut at the last word before 120.
111
- :::
112
-
113
- :::field{name="'none'"}
114
- Omits JSDoc but keeps the generated-by banner.
115
- :::
116
-
117
- ::
118
-
119
92
  ### sdk
120
93
 
121
94
  Generates a class-based SDK. Each instance takes its own client config, so environments can use separate clients. Leave `sdk` unset to keep the standalone functions that query plugins call.
package/docs/overview.md CHANGED
@@ -1,25 +1,29 @@
1
1
  # Fetch
2
2
 
3
- Generates a type-safe HTTP client based on the native Fetch API from your OpenAPI spec. Each operation becomes one async function with grouped `path`, `query`, `headers`, and `body` parameters and a result keyed by status code.
3
+ The Fetch plugin turns each operation in your OpenAPI spec into a typed async function that sends the request with the native Fetch API. Each function takes grouped `path`, `query`, `headers`, and `body` parameters and returns a result keyed by status code.
4
4
 
5
- This plugin provides the client runtime. Query plugins such as `@kubb/plugin-react-query`, `@kubb/plugin-vue-query`, `@kubb/plugin-swr`, and `@kubb/plugin-mcp` call the functions it generates.
5
+ The query plugins (`@kubb/plugin-react-query`, `@kubb/plugin-vue-query`, and `@kubb/plugin-swr`) and `@kubb/plugin-mcp` call these functions. The plugin also copies its runtime files (`client.ts`, `serializers.ts`, and `standardSchema.ts`) to `.kubb/` in the root output folder.
6
6
 
7
7
  ## Setup
8
8
 
9
- - Add `@kubb/plugin-ts` for the operation types. Without it, `@kubb/plugin-zod` with `inferred: true` supplies them.
10
- - Add `@kubb/plugin-zod` when you set `validator`.
11
- - No HTTP client package is needed.
9
+ - Add `@kubb/plugin-ts` for the operation types, or `@kubb/plugin-zod` with `inferred: true`.
10
+ - Add `@kubb/plugin-zod` when you set `validator`, and install `zod` v4. Without the plugin, `validator` does nothing.
11
+ - No HTTP client package is needed. The generated code calls the global `fetch`.
12
12
 
13
13
  ## Options worth knowing
14
14
 
15
- - `baseURL` is prepended to every request.
16
- - `validator: 'zod'` validates request and response bodies with the schemas from `@kubb/plugin-zod`.
17
- - `sdk` generates a class-based SDK, grouped by tag or flat, instead of standalone functions. Query plugins need the standalone functions, so leave `sdk` unset when you use them.
18
- - `returnType: 'data'` makes a call resolve to the success body instead of the full result with status, data, and error.
19
- - `throwOnErrorDefault: false` returns documented error responses as values instead of throwing. A single call can still pass `throwOnError`.
15
+ - `baseURL` is prepended to every request. The spec's `servers` URL is not used, so without `baseURL` you set one at runtime with `client.setConfig({ baseURL })`.
16
+ - `validator: 'zod'` validates response bodies with the schemas from `@kubb/plugin-zod`. Use `{ request: 'zod', response: 'zod' }` to also validate request bodies.
17
+ - `throwOnErrorDefault: false` returns non-2xx responses as values instead of throwing. A single call can still pass `throwOnError`.
18
+ - `returnType: 'data'` makes a call resolve to the success body instead of the full result. With `throwOnError: false`, the call still returns the full result.
19
+ - `sdk` generates a class-based SDK, grouped by tag or flat, instead of standalone functions. The query plugins and `@kubb/plugin-mcp` need the standalone functions, so leave `sdk` unset when you use them.
20
+
21
+ See [Options](https://kubb.dev/extensions/kubb-labs/plugin-fetch/options) for every option and its default.
20
22
 
21
23
  ## Example
22
24
 
25
+ The config below generates a Fetch client that sends every request to the Petstore API.
26
+
23
27
  ```typescript [kubb.config.ts]
24
28
  import { defineConfig } from 'kubb/config'
25
29
  import { pluginTs } from '@kubb/plugin-ts'
@@ -34,8 +38,3 @@ export default defineConfig({
34
38
  ],
35
39
  })
36
40
  ```
37
-
38
- ## See also
39
-
40
- - [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
41
- - [`@kubb/plugin-ts`](https://kubb.dev/extensions/kubb-labs/plugin-ts)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-fetch",
3
- "version": "5.5.10",
3
+ "version": "5.5.11",
4
4
  "description": "Generate a slim, type-safe HTTP client with Kubb based on the native Fetch api.",
5
5
  "keywords": [
6
6
  "api-client",
@@ -68,8 +68,8 @@
68
68
  "registry": "https://registry.npmjs.org/"
69
69
  },
70
70
  "dependencies": {
71
- "@kubb/plugin-ts": "^5.0.9",
72
- "@kubb/plugin-zod": "^5.4.7"
71
+ "@kubb/plugin-ts": "^5.0.10",
72
+ "@kubb/plugin-zod": "^5.4.8"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@internals/client": "0.0.0",