Releases: yhnavein/swaggie
Releases · yhnavein/swaggie
v0.6.8
v0.6.7
v0.6.6
v0.6.5
v0.6.4
v0.6.3
v0.6.2
v0.6.1
v0.6.0
- feat: No longer clients generated as classes. They were quite cumbersome and in this version they are replaced by simple objects.
- feat: Simpler client's usage and support for tree-shaking
- feat: Allows easily to use
axios-extensionsor more advanced axios settings - breaking change: Removed
reactHooksoption. It's no longer necessary. - breaking change:
axiosandfetchtemplates changed to accomodate new method of clients export.
How to migrate:
- Remove all occurences of
useClienthook and import each of clients directly
-import { useClient } from '../../client';
+import { authClient, productClient } from '../../client';
const Component = () => {
-const { authClient, productClient } = useClient();-
Same goes to each usage of
clientsorClientContext -
Remove all class imports from generated client
-import { AuthClient, ProductClient } from '../../client';
+import { authClient, productClient } from '../../client';
const Component = () => {
-const authClient = new AuthClient();
-const productClient = new ProductClient();- Look out for all Interceptors (or other code that reffers to global
Axiosinstance) and replace globalAxiosinstance with the one that is used in generated client.
-import Axios, { AxiosRequestConfig, AxiosError} from 'axios';
+import { AxiosRequestConfig, AxiosError, AxiosInstance } from 'axios';
-export function useAuthInterceptor() {
- Axios.interceptors.request.use([...]
+export function useAuthInterceptor(axios: AxiosInstance) {
+ axios.interceptors.request.use(
- Axios.interceptors.response.use(
+ axios.interceptors.response.use(Axios instance is exposed in the client generated code:
+import { axios } from '../client';
-useAuthInterceptor();
+useAuthInterceptor(axios);