Skip to content

Commit

Permalink
chore: run npm run format
Browse files Browse the repository at this point in the history
  • Loading branch information
BijanRegmi committed May 1, 2024
1 parent d25c506 commit 3cfb3d0
Show file tree
Hide file tree
Showing 11 changed files with 247 additions and 275 deletions.
4 changes: 2 additions & 2 deletions packages/zod/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ export const generateZodValidationSchemaDefinition = (
const separator = schema.allOf
? 'allOf'
: schema.oneOf
? 'oneOf'
: 'anyOf';
? 'oneOf'
: 'anyOf';

const schemas = (schema.allOf ?? schema.oneOf ?? schema.anyOf) as (
| SchemaObject
Expand Down
64 changes: 27 additions & 37 deletions samples/basic/api/endpoints/petstoreFromFileSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,18 @@
* Swagger Petstore
* OpenAPI spec version: 1.0.0
*/
import axios from 'axios'
import type {
AxiosRequestConfig,
AxiosResponse
} from 'axios'
import axios from 'axios';
import type { AxiosRequestConfig, AxiosResponse } from 'axios';
export type CreatePetsBody = {
name: string;
tag: string;
};

export type ListPetsParams = {
/**
* How many items to return at one time (max 100)
*/
limit?: string;
/**
* How many items to return at one time (max 100)
*/
limit?: string;
};

export interface Error {
Expand Down Expand Up @@ -54,46 +51,39 @@ export interface Pet {
*/
export type Pets = Pet[];





/**
/**
* @summary List all pets
*/
export const listPets = <TData = AxiosResponse<Pets>>(
params?: ListPetsParams, options?: AxiosRequestConfig
): Promise<TData> => {
return axios.get(
`/pets`,{
params?: ListPetsParams,
options?: AxiosRequestConfig,
): Promise<TData> => {
return axios.get(`/pets`, {
...options,
params: {...params, ...options?.params},}
);
}
params: { ...params, ...options?.params },
});
};

/**
* @summary Create a pet
*/
export const createPets = <TData = AxiosResponse<void>>(
createPetsBody: CreatePetsBody, options?: AxiosRequestConfig
): Promise<TData> => {
return axios.post(
`/pets`,
createPetsBody,options
);
}
createPetsBody: CreatePetsBody,
options?: AxiosRequestConfig,
): Promise<TData> => {
return axios.post(`/pets`, createPetsBody, options);
};

/**
* @summary Info for a specific pet
*/
export const showPetById = <TData = AxiosResponse<Pet>>(
petId: string, options?: AxiosRequestConfig
): Promise<TData> => {
return axios.get(
`/pets/${petId}`,options
);
}
petId: string,
options?: AxiosRequestConfig,
): Promise<TData> => {
return axios.get(`/pets/${petId}`, options);
};

export type ListPetsResult = AxiosResponse<Pets>
export type CreatePetsResult = AxiosResponse<void>
export type ShowPetByIdResult = AxiosResponse<Pet>
export type ListPetsResult = AxiosResponse<Pets>;
export type CreatePetsResult = AxiosResponse<void>;
export type ShowPetByIdResult = AxiosResponse<Pet>;
64 changes: 27 additions & 37 deletions samples/basic/api/endpoints/petstoreFromFileSpecWithConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,18 @@
* Swagger Petstore
* OpenAPI spec version: 1.0.0
*/
import axios from 'axios'
import type {
AxiosRequestConfig,
AxiosResponse
} from 'axios'
import axios from 'axios';
import type { AxiosRequestConfig, AxiosResponse } from 'axios';
export type CreatePetsBody = {
name: string;
tag: string;
};

export type ListPetsParams = {
/**
* How many items to return at one time (max 100)
*/
limit?: string;
/**
* How many items to return at one time (max 100)
*/
limit?: string;
};

export interface Error {
Expand Down Expand Up @@ -54,46 +51,39 @@ export interface Pet {
*/
export type Pets = Pet[];





/**
/**
* @summary List all pets
*/
export const listPets = <TData = AxiosResponse<Pets>>(
params?: ListPetsParams, options?: AxiosRequestConfig
): Promise<TData> => {
return axios.get(
`/pets`,{
params?: ListPetsParams,
options?: AxiosRequestConfig,
): Promise<TData> => {
return axios.get(`/pets`, {
...options,
params: {...params, ...options?.params},}
);
}
params: { ...params, ...options?.params },
});
};

/**
* @summary Create a pet
*/
export const createPets = <TData = AxiosResponse<void>>(
createPetsBody: CreatePetsBody, options?: AxiosRequestConfig
): Promise<TData> => {
return axios.post(
`/pets`,
createPetsBody,options
);
}
createPetsBody: CreatePetsBody,
options?: AxiosRequestConfig,
): Promise<TData> => {
return axios.post(`/pets`, createPetsBody, options);
};

/**
* @summary Info for a specific pet
*/
export const showPetById = <TData = AxiosResponse<Pet>>(
petId: string, options?: AxiosRequestConfig
): Promise<TData> => {
return axios.get(
`/pets/${petId}`,options
);
}
petId: string,
options?: AxiosRequestConfig,
): Promise<TData> => {
return axios.get(`/pets/${petId}`, options);
};

export type ListPetsResult = AxiosResponse<Pets>
export type CreatePetsResult = AxiosResponse<void>
export type ShowPetByIdResult = AxiosResponse<Pet>
export type ListPetsResult = AxiosResponse<Pets>;
export type CreatePetsResult = AxiosResponse<void>;
export type ShowPetByIdResult = AxiosResponse<Pet>;
Loading

0 comments on commit 3cfb3d0

Please sign in to comment.