Client Composable Patterns
Generated client composables are wrapper layers on top of the base SDK output.
Output structure
When enabled, the module writes client composables into:
openapi/composables/use-fetchopenapi/composables/use-async-dataopenapi/composables/shared/runtime
Param shape pattern
Generated wrappers follow the SDK request shape instead of flattening params.
Typical request objects are grouped by transport concern:
pathquerybodyheaderswhen needed by the underlying SDK call
Example:
ts
useFetchGetPetById({
path: { petId: 123 },
})Shared runtime pattern
Both client families reuse shared helpers for:
onRequest,onSuccess,onError,onFinish- global callbacks from
$getGlobalApiCallbacks - global headers from
useApiHeaders()or$getApiHeaders pickbeforetransform- pagination state and request injection
Family split
useFetch
Best for the simplest Nuxt data-fetching integration.
Pattern:
- native
useFetchergonomics - shared runtime features
- top-level pagination helpers
useAsyncData
Best when cache identity or raw response metadata matters.
Pattern:
- generated cache identity from key + resolved URL + params
- optional
cacheKeyoverride - raw variant support
- pagination helpers inside
pagination.value
Auto-import pattern
When enableAutoImport is enabled, the module registers generated composable directories automatically so pages and components can use them without manual imports.
