You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`body`|`{ [name]:value }`|[requestBody](https://spec.openapis.org/oas/latest.html#request-body-object) data for the endpoint |
36
37
|`querySerializer`| QuerySerializer | (optional) Provide a [querySerializer](#queryserializer)|
37
38
|`bodySerializer`| BodySerializer | (optional) Provide a [bodySerializer](#bodyserializer)|
39
+
|`pathSerializer`| PathSerializer | (optional) Provide a [pathSerializer](#pathserialization)|
38
40
|`parseAs`|`"json"`\|`"text"`\|`"arrayBuffer"`\|`"blob"`\|`"stream"`| (optional) Parse the response using [a built-in instance method](https://developer.mozilla.org/en-US/docs/Web/API/Response#instance_methods) (default: `"json"`). `"stream"` skips parsing altogether and returns the raw stream. |
39
41
|`baseUrl`|`string`| Prefix the fetch URL with this option (e.g. `"https://myapi.dev/v1/"`) |
40
42
|`fetch`|`fetch`| Fetch instance used for requests (default: fetch from `createClient`) |
Similar to [querySerializer](#queryserializer) and [bodySerializer](#bodyserializer), `pathSerializer` allows you to customize how path parameters are serialized. This is useful when your API uses a non-standard path serialization format, or you want to change the default behavior.
216
+
217
+
### Custom Path Serializer
218
+
219
+
You can provide a custom path serializer when creating the client:
220
+
221
+
```ts
222
+
const client =createClient({
223
+
pathSerializer(pathname, pathParams) {
224
+
let result =pathname;
225
+
for (const [key, value] ofObject.entries(pathParams)) {
openapi-fetch supports path serialization as [outlined in the 3.1 spec](https://swagger.io/docs/specification/serialization/#path). This happens automatically, based on the specific format in your OpenAPI schema:
0 commit comments