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
Kubb configuration allows to specification of the data return type for the success case, but in our case, for errors, we want to be able to access the entire Error Object, in this case, the AxiosError.
Right now we are using Orval, and their approach to accomplish this is to create a custom interface in the custom client file and that type will be used in the generated file, similar to what you suggest when creating the RequestConfig.
That said, our goal was to have something configurable in the custom client instead of the kubb configuration file, like the following:
exporttypeRequestConfig<TData=unknown>=AxiosRequestConfig<TData>;exporttypeResponseConfig<TData=unknown>=AxiosResponse<TData>;exporttypeResponseErrorConfig<TError=unknown>=AxiosError<TError>;exportconstcustomInstance=<TData,TError=unknown,TVariables=unknown>(config: RequestConfig<TVariables>): Promise<ResponseConfig<TData>['data']>=>{returninstance.request<TVariables,ResponseConfig<TData>>(config).then(({ data })=>data).catch((e: ResponseErrorConfig<TError>)=>{throwe;});};exportdefaultcustomInstance;
External documents/projects?
No response
What is the feature you are proposing to solve the problem?
No response
What alternatives have you considered?
No response
The text was updated successfully, but these errors were encountered:
What is the problem this feature would solve?
Kubb configuration allows to specification of the data return type for the success case, but in our case, for errors, we want to be able to access the entire Error Object, in this case, the AxiosError.
Right now we are using Orval, and their approach to accomplish this is to create a custom interface in the custom client file and that type will be used in the generated file, similar to what you suggest when creating the
RequestConfig
.That said, our goal was to have something configurable in the custom client instead of the kubb configuration file, like the following:
External documents/projects?
No response
What is the feature you are proposing to solve the problem?
No response
What alternatives have you considered?
No response
The text was updated successfully, but these errors were encountered: