Skip to content

Commit 47bef43

Browse files
committed
test: 同步单测
1 parent c971836 commit 47bef43

7 files changed

Lines changed: 62 additions & 62 deletions

File tree

test/example-dest/2.0/pet-store.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type AxiosRequestConfig = Parameters<typeof axios.request>[0];
2828
* @param [config] request config
2929
*/
3030
export async function addPet(data:Type.AddPetData,config?:AxiosRequestConfig) {
31-
zAddPetData.parse(data)
31+
zAddPetData.parse(data);
3232
const resp = await axios<unknown>({
3333
method: "POST",
3434
url: "/pet",
@@ -45,7 +45,7 @@ return resp;
4545
* @param [config] request config
4646
*/
4747
export async function updatePet(data:Type.UpdatePetData,config?:AxiosRequestConfig) {
48-
zUpdatePetData.parse(data)
48+
zUpdatePetData.parse(data);
4949
const resp = await axios<unknown>({
5050
method: "PUT",
5151
url: "/pet",
@@ -63,7 +63,7 @@ return resp;
6363
* @returns successful operation
6464
*/
6565
export async function findPetsByStatus(status:Type.FindPetsByStatusParams,config?:AxiosRequestConfig) {
66-
zFindPetsByStatusParams.parse(status)
66+
zFindPetsByStatusParams.parse(status);
6767
const resp = await axios<Type.FindPetsByStatusResponse>({
6868
method: "GET",
6969
url: "/pet/findByStatus",
@@ -83,7 +83,7 @@ return resp;
8383
* @returns successful operation
8484
*/
8585
export async function findPetsByTags(tags:Type.FindPetsByTagsParams,config?:AxiosRequestConfig) {
86-
zFindPetsByTagsParams.parse(tags)
86+
zFindPetsByTagsParams.parse(tags);
8787
const resp = await axios<Type.FindPetsByTagsResponse>({
8888
method: "GET",
8989
url: "/pet/findByTags",
@@ -102,7 +102,7 @@ return resp;
102102
* @returns successful operation
103103
*/
104104
export async function getPetById(petId:Type.GetPetByIdPath,config?:AxiosRequestConfig) {
105-
zGetPetByIdPath.parse(petId)
105+
zGetPetByIdPath.parse(petId);
106106
const resp = await axios<Type.GetPetByIdResponse>({
107107
method: "GET",
108108
url: `/pet/${petId}`,
@@ -120,8 +120,8 @@ return resp;
120120
* @param [config] request config
121121
*/
122122
export async function updatePetWithForm(petId:Type.UpdatePetWithFormPath,data:Type.UpdatePetWithFormData,config?:AxiosRequestConfig) {
123-
zUpdatePetWithFormPath.parse(petId)
124-
zUpdatePetWithFormData.parse(data)
123+
zUpdatePetWithFormPath.parse(petId);
124+
zUpdatePetWithFormData.parse(data);
125125
const resp = await axios<unknown>({
126126
method: "POST",
127127
url: `/pet/${petId}`,
@@ -139,8 +139,8 @@ return resp;
139139
* @param [config] request config
140140
*/
141141
export async function deletePet(petId:Type.DeletePetPath,apiKey?:Type.DeletePetHeaders,config?:AxiosRequestConfig) {
142-
zDeletePetPath.parse(petId)
143-
(apiKey !== undefined) && zDeletePetHeaders.parse(apiKey)
142+
zDeletePetPath.parse(petId);
143+
(apiKey !== undefined) && zDeletePetHeaders.parse(apiKey);
144144
const resp = await axios<unknown>({
145145
method: "DELETE",
146146
url: `/pet/${petId}`,
@@ -159,8 +159,8 @@ return resp;
159159
* @returns successful operation
160160
*/
161161
export async function uploadFile(petId:Type.UploadFilePath,data:Type.UploadFileData,config?:AxiosRequestConfig) {
162-
zUploadFilePath.parse(petId)
163-
zUploadFileData.parse(data)
162+
zUploadFilePath.parse(petId);
163+
zUploadFileData.parse(data);
164164
const resp = await axios<Type.UploadFileResponse>({
165165
method: "POST",
166166
url: `/pet/${petId}/uploadImage`,
@@ -195,7 +195,7 @@ return resp;
195195
* @returns successful operation
196196
*/
197197
export async function placeOrder(data:Type.PlaceOrderData,config?:AxiosRequestConfig) {
198-
zPlaceOrderData.parse(data)
198+
zPlaceOrderData.parse(data);
199199
const resp = await axios<Type.PlaceOrderResponse>({
200200
method: "POST",
201201
url: "/store/order",
@@ -214,7 +214,7 @@ return resp;
214214
* @returns successful operation
215215
*/
216216
export async function getOrderById(orderId:Type.GetOrderByIdPath,config?:AxiosRequestConfig) {
217-
zGetOrderByIdPath.parse(orderId)
217+
zGetOrderByIdPath.parse(orderId);
218218
const resp = await axios<Type.GetOrderByIdResponse>({
219219
method: "GET",
220220
url: `/store/order/${orderId}`,
@@ -231,7 +231,7 @@ return resp;
231231
* @param [config] request config
232232
*/
233233
export async function deleteOrder(orderId:Type.DeleteOrderPath,config?:AxiosRequestConfig) {
234-
zDeleteOrderPath.parse(orderId)
234+
zDeleteOrderPath.parse(orderId);
235235
const resp = await axios<unknown>({
236236
method: "DELETE",
237237
url: `/store/order/${orderId}`,
@@ -247,7 +247,7 @@ return resp;
247247
* @param [config] request config
248248
*/
249249
export async function createUser(data:Type.CreateUserData,config?:AxiosRequestConfig) {
250-
zCreateUserData.parse(data)
250+
zCreateUserData.parse(data);
251251
const resp = await axios<unknown>({
252252
method: "POST",
253253
url: "/user",
@@ -264,7 +264,7 @@ return resp;
264264
* @param [config] request config
265265
*/
266266
export async function createUsersWithArrayInput(data:Type.CreateUsersWithArrayInputData,config?:AxiosRequestConfig) {
267-
zCreateUsersWithArrayInputData.parse(data)
267+
zCreateUsersWithArrayInputData.parse(data);
268268
const resp = await axios<unknown>({
269269
method: "POST",
270270
url: "/user/createWithArray",
@@ -281,7 +281,7 @@ return resp;
281281
* @param [config] request config
282282
*/
283283
export async function createUsersWithListInput(data:Type.CreateUsersWithListInputData,config?:AxiosRequestConfig) {
284-
zCreateUsersWithListInputData.parse(data)
284+
zCreateUsersWithListInputData.parse(data);
285285
const resp = await axios<unknown>({
286286
method: "POST",
287287
url: "/user/createWithList",
@@ -299,7 +299,7 @@ return resp;
299299
* @returns successful operation
300300
*/
301301
export async function loginUser(params:Type.LoginUserParams,config?:AxiosRequestConfig) {
302-
zLoginUserParams.parse(params)
302+
zLoginUserParams.parse(params);
303303
const resp = await axios<Type.LoginUserResponse>({
304304
method: "GET",
305305
url: "/user/login",
@@ -332,7 +332,7 @@ return resp;
332332
* @returns successful operation
333333
*/
334334
export async function getUserByName(username:Type.GetUserByNamePath,config?:AxiosRequestConfig) {
335-
zGetUserByNamePath.parse(username)
335+
zGetUserByNamePath.parse(username);
336336
const resp = await axios<Type.GetUserByNameResponse>({
337337
method: "GET",
338338
url: `/user/${username}`,
@@ -349,7 +349,7 @@ return resp;
349349
* @param [config] request config
350350
*/
351351
export async function deleteUser(username:Type.DeleteUserPath,config?:AxiosRequestConfig) {
352-
zDeleteUserPath.parse(username)
352+
zDeleteUserPath.parse(username);
353353
const resp = await axios<unknown>({
354354
method: "DELETE",
355355
url: `/user/${username}`,
@@ -366,8 +366,8 @@ return resp;
366366
* @param [config] request config
367367
*/
368368
export async function updateUser(username:Type.UpdateUserPath,data:Type.UpdateUserData,config?:AxiosRequestConfig) {
369-
zUpdateUserPath.parse(username)
370-
zUpdateUserData.parse(data)
369+
zUpdateUserPath.parse(username);
370+
zUpdateUserData.parse(data);
371371
const resp = await axios<unknown>({
372372
method: "PUT",
373373
url: `/user/${username}`,

test/example-dest/2.0/pet-store.zod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @description This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
1010
*/
1111

12-
import {z as z} from "zod";
12+
import { z } from "zod";
1313

1414
export const zOrder = z.object({
1515
"id": z.optional(z.number()),

test/example-dest/3.0/pet-store.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type AxiosRequestConfig = Parameters<typeof axios.request>[0];
3636
* @returns Successful operation
3737
*/
3838
export async function addPet(data:Type.AddPetData,config?:AxiosRequestConfig) {
39-
zAddPetData.parse(data)
39+
zAddPetData.parse(data);
4040
const resp = await axios<Type.AddPetResponse>({
4141
method: "POST",
4242
url: "/pet",
@@ -55,7 +55,7 @@ return resp;
5555
* @returns Successful operation
5656
*/
5757
export async function updatePet(data:Type.UpdatePetData,config?:AxiosRequestConfig) {
58-
zUpdatePetData.parse(data)
58+
zUpdatePetData.parse(data);
5959
const resp = await axios<Type.UpdatePetResponse>({
6060
method: "PUT",
6161
url: "/pet",
@@ -74,7 +74,7 @@ return resp;
7474
* @returns successful operation
7575
*/
7676
export async function findPetsByStatus(status?:Type.FindPetsByStatusParams,config?:AxiosRequestConfig) {
77-
(status !== undefined) && zFindPetsByStatusParams.parse(status)
77+
(status !== undefined) && zFindPetsByStatusParams.parse(status);
7878
const resp = await axios<Type.FindPetsByStatusResponse>({
7979
method: "GET",
8080
url: "/pet/findByStatus",
@@ -93,7 +93,7 @@ return resp;
9393
* @returns successful operation
9494
*/
9595
export async function findPetsByTags(tags?:Type.FindPetsByTagsParams,config?:AxiosRequestConfig) {
96-
(tags !== undefined) && zFindPetsByTagsParams.parse(tags)
96+
(tags !== undefined) && zFindPetsByTagsParams.parse(tags);
9797
const resp = await axios<Type.FindPetsByTagsResponse>({
9898
method: "GET",
9999
url: "/pet/findByTags",
@@ -112,7 +112,7 @@ return resp;
112112
* @returns successful operation
113113
*/
114114
export async function getPetById(petId:Type.GetPetByIdPath,config?:AxiosRequestConfig) {
115-
zGetPetByIdPath.parse(petId)
115+
zGetPetByIdPath.parse(petId);
116116
const resp = await axios<Type.GetPetByIdResponse>({
117117
method: "GET",
118118
url: `/pet/${petId}`,
@@ -130,8 +130,8 @@ return resp;
130130
* @param [config] request config
131131
*/
132132
export async function updatePetWithForm(petId:Type.UpdatePetWithFormPath,params?:Type.UpdatePetWithFormParams,config?:AxiosRequestConfig) {
133-
zUpdatePetWithFormPath.parse(petId)
134-
(params !== undefined) && zUpdatePetWithFormParams.parse(params)
133+
zUpdatePetWithFormPath.parse(petId);
134+
(params !== undefined) && zUpdatePetWithFormParams.parse(params);
135135
const resp = await axios<unknown>({
136136
method: "POST",
137137
url: `/pet/${petId}`,
@@ -149,8 +149,8 @@ return resp;
149149
* @param [config] request config
150150
*/
151151
export async function deletePet(petId:Type.DeletePetPath,apiKey?:Type.DeletePetHeaders,config?:AxiosRequestConfig) {
152-
zDeletePetPath.parse(petId)
153-
(apiKey !== undefined) && zDeletePetHeaders.parse(apiKey)
152+
zDeletePetPath.parse(petId);
153+
(apiKey !== undefined) && zDeletePetHeaders.parse(apiKey);
154154
const resp = await axios<unknown>({
155155
method: "DELETE",
156156
url: `/pet/${petId}`,
@@ -170,9 +170,9 @@ return resp;
170170
* @returns successful operation
171171
*/
172172
export async function uploadFile(petId:Type.UploadFilePath,data:Type.UploadFileData,additionalMetadata?:Type.UploadFileParams,config?:AxiosRequestConfig) {
173-
zUploadFilePath.parse(petId)
174-
zUploadFileData.parse(data)
175-
(additionalMetadata !== undefined) && zUploadFileParams.parse(additionalMetadata)
173+
zUploadFilePath.parse(petId);
174+
zUploadFileData.parse(data);
175+
(additionalMetadata !== undefined) && zUploadFileParams.parse(additionalMetadata);
176176
const resp = await axios<Type.UploadFileResponse>({
177177
method: "POST",
178178
url: `/pet/${petId}/uploadImage`,
@@ -208,7 +208,7 @@ return resp;
208208
* @returns successful operation
209209
*/
210210
export async function placeOrder(data:Type.PlaceOrderData,config?:AxiosRequestConfig) {
211-
zPlaceOrderData.parse(data)
211+
zPlaceOrderData.parse(data);
212212
const resp = await axios<Type.PlaceOrderResponse>({
213213
method: "POST",
214214
url: "/store/order",
@@ -227,7 +227,7 @@ return resp;
227227
* @returns successful operation
228228
*/
229229
export async function getOrderById(orderId:Type.GetOrderByIdPath,config?:AxiosRequestConfig) {
230-
zGetOrderByIdPath.parse(orderId)
230+
zGetOrderByIdPath.parse(orderId);
231231
const resp = await axios<Type.GetOrderByIdResponse>({
232232
method: "GET",
233233
url: `/store/order/${orderId}`,
@@ -244,7 +244,7 @@ return resp;
244244
* @param [config] request config
245245
*/
246246
export async function deleteOrder(orderId:Type.DeleteOrderPath,config?:AxiosRequestConfig) {
247-
zDeleteOrderPath.parse(orderId)
247+
zDeleteOrderPath.parse(orderId);
248248
const resp = await axios<unknown>({
249249
method: "DELETE",
250250
url: `/store/order/${orderId}`,
@@ -260,7 +260,7 @@ return resp;
260260
* @param [config] request config
261261
*/
262262
export async function createUser(data:Type.CreateUserData,config?:AxiosRequestConfig) {
263-
zCreateUserData.parse(data)
263+
zCreateUserData.parse(data);
264264
const resp = await axios<unknown>({
265265
method: "POST",
266266
url: "/user",
@@ -278,7 +278,7 @@ return resp;
278278
* @returns Successful operation
279279
*/
280280
export async function createUsersWithListInput(data:Type.CreateUsersWithListInputData,config?:AxiosRequestConfig) {
281-
zCreateUsersWithListInputData.parse(data)
281+
zCreateUsersWithListInputData.parse(data);
282282
const resp = await axios<Type.CreateUsersWithListInputResponse>({
283283
method: "POST",
284284
url: "/user/createWithList",
@@ -297,7 +297,7 @@ return resp;
297297
* @returns successful operation
298298
*/
299299
export async function loginUser(params?:Type.LoginUserParams,config?:AxiosRequestConfig) {
300-
(params !== undefined) && zLoginUserParams.parse(params)
300+
(params !== undefined) && zLoginUserParams.parse(params);
301301
const resp = await axios<Type.LoginUserResponse>({
302302
method: "GET",
303303
url: "/user/login",
@@ -330,7 +330,7 @@ return resp;
330330
* @returns successful operation
331331
*/
332332
export async function getUserByName(username:Type.GetUserByNamePath,config?:AxiosRequestConfig) {
333-
zGetUserByNamePath.parse(username)
333+
zGetUserByNamePath.parse(username);
334334
const resp = await axios<Type.GetUserByNameResponse>({
335335
method: "GET",
336336
url: `/user/${username}`,
@@ -347,7 +347,7 @@ return resp;
347347
* @param [config] request config
348348
*/
349349
export async function deleteUser(username:Type.DeleteUserPath,config?:AxiosRequestConfig) {
350-
zDeleteUserPath.parse(username)
350+
zDeleteUserPath.parse(username);
351351
const resp = await axios<unknown>({
352352
method: "DELETE",
353353
url: `/user/${username}`,
@@ -364,8 +364,8 @@ return resp;
364364
* @param [config] request config
365365
*/
366366
export async function updateUser(username:Type.UpdateUserPath,data:Type.UpdateUserData,config?:AxiosRequestConfig) {
367-
zUpdateUserPath.parse(username)
368-
zUpdateUserData.parse(data)
367+
zUpdateUserPath.parse(username);
368+
zUpdateUserData.parse(data);
369369
const resp = await axios<unknown>({
370370
method: "PUT",
371371
url: `/user/${username}`,

test/example-dest/3.0/pet-store.zod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* - [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)
1717
*/
1818

19-
import {z as z} from "zod";
19+
import { z } from "zod";
2020

2121
export const zOrder = z.object({
2222
"id": z.optional(z.number()),

test/example-dest/3.1/pet-store.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type AxiosRequestConfig = Parameters<typeof axios.request>[0];
3333
* @returns Successful operation
3434
*/
3535
export async function updatePet(data:Type.UpdatePetData,config?:AxiosRequestConfig) {
36-
zUpdatePetData.parse(data)
36+
zUpdatePetData.parse(data);
3737
const resp = await axios<Type.UpdatePetResponse>({
3838
method: "PUT",
3939
url: "/pet",
@@ -52,7 +52,7 @@ return resp;
5252
* @returns Successful operation
5353
*/
5454
export async function addPet(data:Type.AddPetData,config?:AxiosRequestConfig) {
55-
zAddPetData.parse(data)
55+
zAddPetData.parse(data);
5656
const resp = await axios<Type.AddPetResponse>({
5757
method: "POST",
5858
url: "/pet",
@@ -69,7 +69,7 @@ return resp;
6969
* @param [config] request config
7070
*/
7171
export async function getPetById(petId:Type.GetPetByIdPath,config?:AxiosRequestConfig) {
72-
zGetPetByIdPath.parse(petId)
72+
zGetPetByIdPath.parse(petId);
7373
const resp = await axios<unknown>({
7474
method: "GET",
7575
url: `/pet/${petId}`,

test/example-dest/3.1/pet-store.zod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* @see {@link http://swagger.io Find out more about Swagger}
1414
*/
1515

16-
import {z as z} from "zod";
16+
import { z } from "zod";
1717

1818
export const zCategory = z.object({
1919
"id": z.optional(z.number()),

0 commit comments

Comments
 (0)