Skip to content
Discussion options

You must be logged in to vote

You should not need to parse the already-built URL in a custom fetch client anymore. Orval has a request-level override.paramsSerializer hook that is valid for the fetch client too.

Example:

// orval.config.ts
import { defineConfig } from 'orval'

export default defineConfig({
  api: {
    input: './openapi.yaml',
    output: {
      client: 'fetch',
      target: './src/api.ts',
      override: {
        paramsSerializer: {
          path: './src/custom-params-serializer.ts',
          name: 'customParamsSerializer',
        },
      },
    },
  },
})
// src/custom-params-serializer.ts
import qs from 'qs'

export const customParamsSerializer = (
  params: Record<string, unknown> | undefined

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@rroberrt
Comment options

@rroberrt
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by sina-saeedi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
fetch Fetch client related issue
4 participants