Skip to content

Commit

Permalink
fix: removal of .schema (#744)
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnvanhulle authored Dec 22, 2023
1 parent 6756ae9 commit 1927d89
Show file tree
Hide file tree
Showing 51 changed files with 80 additions and 99 deletions.
5 changes: 5 additions & 0 deletions .changeset/short-mirrors-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kubb/swagger-zod": patch
---

Removal of '.schema' for references
4 changes: 2 additions & 2 deletions examples/advanced/src/gen/zod/addPetRequestSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { z } from 'zod'
export const addPetRequestSchema = z.object({
'id': z.number().optional(),
'name': z.string(),
'category': z.lazy(() => categorySchema).schema.optional(),
'category': z.lazy(() => categorySchema).optional(),
'photoUrls': z.array(z.string()),
'tags': z.array(z.lazy(() => tagSchema).schema).optional(),
'tags': z.array(z.lazy(() => tagSchema)).optional(),
'status': z.enum([`available`, `pending`, `sold`]).describe(`pet status in the store`).optional(),
})
2 changes: 1 addition & 1 deletion examples/advanced/src/gen/zod/customerSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import { z } from 'zod'
export const customerSchema = z.object({
'id': z.number().optional(),
'username': z.string().optional(),
'address': z.array(z.lazy(() => addressSchema).schema).optional(),
'address': z.array(z.lazy(() => addressSchema)).optional(),
})
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const addPet405Schema = z.object({ 'code': z.number().optional(), 'messag
/**
* @description Create a new pet in the store
*/
export const addPetMutationRequestSchema = z.lazy(() => addPetRequestSchema).schema
export const addPetMutationRequestSchema = z.lazy(() => addPetRequestSchema)

/**
* @description Successful operation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ export const findPetsByStatusQueryParamsSchema = z.object({
/**
* @description successful operation
*/
export const findPetsByStatusQueryResponseSchema = z.array(z.lazy(() => petSchema).schema)
export const findPetsByStatusQueryResponseSchema = z.array(z.lazy(() => petSchema))
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ export const findPetsByTagsQueryParamsSchema = z.object({
/**
* @description successful operation
*/
export const findPetsByTagsQueryResponseSchema = z.array(z.lazy(() => petSchema).schema)
export const findPetsByTagsQueryResponseSchema = z.array(z.lazy(() => petSchema))
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export const uploadFileQueryParamsSchema = z.object({ 'additionalMetadata': z.st
/**
* @description successful operation
*/
export const uploadFileMutationResponseSchema = z.lazy(() => apiResponseSchema).schema
export const uploadFileMutationResponseSchema = z.lazy(() => apiResponseSchema)
4 changes: 2 additions & 2 deletions examples/advanced/src/gen/zod/petSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { z } from 'zod'
export const petSchema = z.object({
'id': z.number().readonly().optional(),
'name': z.string(),
'category': z.lazy(() => categorySchema).schema.optional(),
'category': z.lazy(() => categorySchema).optional(),
'photoUrls': z.array(z.string()),
'tags': z.array(z.lazy(() => tagSchema).schema).optional(),
'tags': z.array(z.lazy(() => tagSchema)).optional(),
'status': z.enum([`available`, `pending`, `sold`]).describe(`pet status in the store`).optional(),
})
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ export const createPetsQueryParamsSchema = z.object({ 'offset': z.number().descr
/**
* @description unexpected error
*/
export const createPetsErrorSchema = z.lazy(() => petNotFoundSchema).schema
export const createPetsErrorSchema = z.lazy(() => petNotFoundSchema)
2 changes: 1 addition & 1 deletion examples/advanced/src/gen/zod/userArraySchema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { userSchema } from './userSchema'
import { z } from 'zod'

export const userArraySchema = z.array(z.lazy(() => userSchema).schema)
export const userArraySchema = z.array(z.lazy(() => userSchema))
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export const createUserMutationResponseSchema = z.any()
/**
* @description successful operation
*/
export const createUserErrorSchema = z.lazy(() => userSchema).schema
export const createUserErrorSchema = z.lazy(() => userSchema)

/**
* @description Created user object
*/
export const createUserMutationRequestSchema = z.lazy(() => userSchema).schema
export const createUserMutationRequestSchema = z.lazy(() => userSchema)
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { userSchema } from '../userSchema'
* @description successful operation
*/
export const createUsersWithListInputErrorSchema = z.any()
export const createUsersWithListInputMutationRequestSchema = z.array(z.lazy(() => userSchema).schema)
export const createUsersWithListInputMutationRequestSchema = z.array(z.lazy(() => userSchema))

/**
* @description Successful operation
*/
export const createUsersWithListInputMutationResponseSchema = z.lazy(() => userSchema).schema
export const createUsersWithListInputMutationResponseSchema = z.lazy(() => userSchema)
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ export const getUserByNamePathParamsSchema = z.object({ 'username': z.string().d
/**
* @description successful operation
*/
export const getUserByNameQueryResponseSchema = z.lazy(() => userSchema).schema
export const getUserByNameQueryResponseSchema = z.lazy(() => userSchema)
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ export const updateUserPathParamsSchema = z.object({ 'username': z.string().desc
/**
* @description Update an existent user in the store
*/
export const updateUserMutationRequestSchema = z.lazy(() => userSchema).schema
export const updateUserMutationRequestSchema = z.lazy(() => userSchema)
4 changes: 2 additions & 2 deletions examples/zod/src/gen/zod/addPetRequestSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { z } from 'zod'
export const addPetRequestSchema = z.object({
id: z.number().optional(),
name: z.string(),
category: z.lazy(() => categorySchema).schema.optional(),
category: z.lazy(() => categorySchema).optional(),
photoUrls: z.array(z.string()),
tags: z.array(z.lazy(() => tagSchema).schema).optional(),
tags: z.array(z.lazy(() => tagSchema)).optional(),
status: z.enum([`available`, `pending`, `sold`]).describe(`pet status in the store`).optional(),
})
4 changes: 2 additions & 2 deletions examples/zod/src/gen/zod/addPetSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export const addPet405Schema = z.object({ code: z.number().optional(), message:
/**
* @description Create a new pet in the store
*/
export const addPetMutationRequestSchema = z.lazy(() => addPetRequestSchema).schema
export const addPetMutationRequestSchema = z.lazy(() => addPetRequestSchema)

/**
* @description Successful operation
*/
export const addPetMutationResponseSchema = z.lazy(() => petSchema).schema
export const addPetMutationResponseSchema = z.lazy(() => petSchema)
4 changes: 2 additions & 2 deletions examples/zod/src/gen/zod/createUserSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export const createUserMutationResponseSchema = z.any()
/**
* @description successful operation
*/
export const createUserErrorSchema = z.lazy(() => userSchema).schema
export const createUserErrorSchema = z.lazy(() => userSchema)

/**
* @description Created user object
*/
export const createUserMutationRequestSchema = z.lazy(() => userSchema).schema
export const createUserMutationRequestSchema = z.lazy(() => userSchema)
4 changes: 2 additions & 2 deletions examples/zod/src/gen/zod/createUsersWithListInputSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { userSchema } from './userSchema'
* @description successful operation
*/
export const createUsersWithListInputErrorSchema = z.any()
export const createUsersWithListInputMutationRequestSchema = z.array(z.lazy(() => userSchema).schema)
export const createUsersWithListInputMutationRequestSchema = z.array(z.lazy(() => userSchema))

/**
* @description Successful operation
*/
export const createUsersWithListInputMutationResponseSchema = z.lazy(() => userSchema).schema
export const createUsersWithListInputMutationResponseSchema = z.lazy(() => userSchema)
6 changes: 1 addition & 5 deletions examples/zod/src/gen/zod/customerSchema.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import { addressSchema } from './addressSchema'
import { z } from 'zod'

export const customerSchema = z.object({
id: z.number().optional(),
username: z.string().optional(),
address: z.array(z.lazy(() => addressSchema).schema).optional(),
})
export const customerSchema = z.object({ id: z.number().optional(), username: z.string().optional(), address: z.array(z.lazy(() => addressSchema)).optional() })
2 changes: 1 addition & 1 deletion examples/zod/src/gen/zod/findPetsByStatusSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ export const findPetsByStatusQueryParamsSchema = z.object({
/**
* @description successful operation
*/
export const findPetsByStatusQueryResponseSchema = z.array(z.lazy(() => petSchema).schema)
export const findPetsByStatusQueryResponseSchema = z.array(z.lazy(() => petSchema))
2 changes: 1 addition & 1 deletion examples/zod/src/gen/zod/findPetsByTagsSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ export const findPetsByTagsQueryParamsSchema = z.object({
/**
* @description successful operation
*/
export const findPetsByTagsQueryResponseSchema = z.array(z.lazy(() => petSchema).schema)
export const findPetsByTagsQueryResponseSchema = z.array(z.lazy(() => petSchema))
2 changes: 1 addition & 1 deletion examples/zod/src/gen/zod/getOrderByIdSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ export const getOrderByIdPathParamsSchema = z.object({ orderId: z.number().descr
/**
* @description successful operation
*/
export const getOrderByIdQueryResponseSchema = z.lazy(() => orderSchema).schema
export const getOrderByIdQueryResponseSchema = z.lazy(() => orderSchema)
2 changes: 1 addition & 1 deletion examples/zod/src/gen/zod/getPetByIdSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ export const getPetByIdPathParamsSchema = z.object({ petId: z.number().describe(
/**
* @description successful operation
*/
export const getPetByIdQueryResponseSchema = z.lazy(() => petSchema).schema
export const getPetByIdQueryResponseSchema = z.lazy(() => petSchema)
2 changes: 1 addition & 1 deletion examples/zod/src/gen/zod/getUserByNameSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ export const getUserByNamePathParamsSchema = z.object({ username: z.string().des
/**
* @description successful operation
*/
export const getUserByNameQueryResponseSchema = z.lazy(() => userSchema).schema
export const getUserByNameQueryResponseSchema = z.lazy(() => userSchema)
4 changes: 2 additions & 2 deletions examples/zod/src/gen/zod/petSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { z } from 'zod'
export const petSchema = z.object({
id: z.number().optional(),
name: z.string(),
category: z.lazy(() => categorySchema).schema.optional(),
category: z.lazy(() => categorySchema).optional(),
photoUrls: z.array(z.string()),
tags: z.array(z.lazy(() => tagSchema).schema).optional(),
tags: z.array(z.lazy(() => tagSchema)).optional(),
status: z.enum([`available`, `pending`, `sold`]).describe(`pet status in the store`).optional(),
})
4 changes: 2 additions & 2 deletions examples/zod/src/gen/zod/placeOrderPatchSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { orderSchema } from './orderSchema'
* @description Invalid input
*/
export const placeOrderPatch405Schema = z.any()
export const placeOrderPatchMutationRequestSchema = z.lazy(() => orderSchema).schema
export const placeOrderPatchMutationRequestSchema = z.lazy(() => orderSchema)

/**
* @description successful operation
*/
export const placeOrderPatchMutationResponseSchema = z.lazy(() => orderSchema).schema
export const placeOrderPatchMutationResponseSchema = z.lazy(() => orderSchema)
4 changes: 2 additions & 2 deletions examples/zod/src/gen/zod/placeOrderSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { orderSchema } from './orderSchema'
* @description Invalid input
*/
export const placeOrder405Schema = z.any()
export const placeOrderMutationRequestSchema = z.lazy(() => orderSchema).schema
export const placeOrderMutationRequestSchema = z.lazy(() => orderSchema)

/**
* @description successful operation
*/
export const placeOrderMutationResponseSchema = z.lazy(() => orderSchema).schema
export const placeOrderMutationResponseSchema = z.lazy(() => orderSchema)
4 changes: 2 additions & 2 deletions examples/zod/src/gen/zod/updatePetSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export const updatePet405Schema = z.any()
/**
* @description Update an existent pet in the store
*/
export const updatePetMutationRequestSchema = z.lazy(() => petSchema).schema
export const updatePetMutationRequestSchema = z.lazy(() => petSchema)

/**
* @description Successful operation
*/
export const updatePetMutationResponseSchema = z.lazy(() => petSchema).schema
export const updatePetMutationResponseSchema = z.lazy(() => petSchema)
2 changes: 1 addition & 1 deletion examples/zod/src/gen/zod/updateUserSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ export const updateUserPathParamsSchema = z.object({ username: z.string().descri
/**
* @description Update an existent user in the store
*/
export const updateUserMutationRequestSchema = z.lazy(() => userSchema).schema
export const updateUserMutationRequestSchema = z.lazy(() => userSchema)
2 changes: 1 addition & 1 deletion examples/zod/src/gen/zod/uploadFileSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export const uploadFileQueryParamsSchema = z.object({ additionalMetadata: z.stri
/**
* @description successful operation
*/
export const uploadFileMutationResponseSchema = z.lazy(() => apiResponseSchema).schema
export const uploadFileMutationResponseSchema = z.lazy(() => apiResponseSchema)
2 changes: 1 addition & 1 deletion examples/zod/src/gen/zod/userArraySchema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { userSchema } from './userSchema'
import { z } from 'zod'

export const userArraySchema = z.array(z.lazy(() => userSchema).schema)
export const userArraySchema = z.array(z.lazy(() => userSchema))
4 changes: 2 additions & 2 deletions examples/zodios/src/gen/zod/addPetRequestSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { z } from 'zod'
export const addPetRequestSchema = z.object({
id: z.number().optional(),
name: z.string(),
category: z.lazy(() => categorySchema).schema.optional(),
category: z.lazy(() => categorySchema).optional(),
photoUrls: z.array(z.string()),
tags: z.array(z.lazy(() => tagSchema).schema).optional(),
tags: z.array(z.lazy(() => tagSchema)).optional(),
status: z.enum([`available`, `pending`, `sold`]).describe(`pet status in the store`).optional(),
})
4 changes: 2 additions & 2 deletions examples/zodios/src/gen/zod/addPetSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export const addPet405Schema = z.object({ code: z.number().optional(), message:
/**
* @description Create a new pet in the store
*/
export const addPetMutationRequestSchema = z.lazy(() => addPetRequestSchema).schema
export const addPetMutationRequestSchema = z.lazy(() => addPetRequestSchema)

/**
* @description Successful operation
*/
export const addPetMutationResponseSchema = z.lazy(() => petSchema).schema
export const addPetMutationResponseSchema = z.lazy(() => petSchema)
4 changes: 2 additions & 2 deletions examples/zodios/src/gen/zod/createUserSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export const createUserMutationResponseSchema = z.any()
/**
* @description successful operation
*/
export const createUserErrorSchema = z.lazy(() => userSchema).schema
export const createUserErrorSchema = z.lazy(() => userSchema)

/**
* @description Created user object
*/
export const createUserMutationRequestSchema = z.lazy(() => userSchema).schema
export const createUserMutationRequestSchema = z.lazy(() => userSchema)
4 changes: 2 additions & 2 deletions examples/zodios/src/gen/zod/createUsersWithListInputSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { userSchema } from './userSchema'
* @description successful operation
*/
export const createUsersWithListInputErrorSchema = z.any()
export const createUsersWithListInputMutationRequestSchema = z.array(z.lazy(() => userSchema).schema)
export const createUsersWithListInputMutationRequestSchema = z.array(z.lazy(() => userSchema))

/**
* @description Successful operation
*/
export const createUsersWithListInputMutationResponseSchema = z.lazy(() => userSchema).schema
export const createUsersWithListInputMutationResponseSchema = z.lazy(() => userSchema)
6 changes: 1 addition & 5 deletions examples/zodios/src/gen/zod/customerSchema.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import { addressSchema } from './addressSchema'
import { z } from 'zod'

export const customerSchema = z.object({
id: z.number().optional(),
username: z.string().optional(),
address: z.array(z.lazy(() => addressSchema).schema).optional(),
})
export const customerSchema = z.object({ id: z.number().optional(), username: z.string().optional(), address: z.array(z.lazy(() => addressSchema)).optional() })
2 changes: 1 addition & 1 deletion examples/zodios/src/gen/zod/findPetsByStatusSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ export const findPetsByStatusQueryParamsSchema = z.object({
/**
* @description successful operation
*/
export const findPetsByStatusQueryResponseSchema = z.array(z.lazy(() => petSchema).schema)
export const findPetsByStatusQueryResponseSchema = z.array(z.lazy(() => petSchema))
2 changes: 1 addition & 1 deletion examples/zodios/src/gen/zod/findPetsByTagsSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ export const findPetsByTagsQueryParamsSchema = z.object({
/**
* @description successful operation
*/
export const findPetsByTagsQueryResponseSchema = z.array(z.lazy(() => petSchema).schema)
export const findPetsByTagsQueryResponseSchema = z.array(z.lazy(() => petSchema))
2 changes: 1 addition & 1 deletion examples/zodios/src/gen/zod/getOrderByIdSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ export const getOrderByIdPathParamsSchema = z.object({ orderId: z.number().descr
/**
* @description successful operation
*/
export const getOrderByIdQueryResponseSchema = z.lazy(() => orderSchema).schema
export const getOrderByIdQueryResponseSchema = z.lazy(() => orderSchema)
2 changes: 1 addition & 1 deletion examples/zodios/src/gen/zod/getPetByIdSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ export const getPetByIdPathParamsSchema = z.object({ petId: z.number().describe(
/**
* @description successful operation
*/
export const getPetByIdQueryResponseSchema = z.lazy(() => petSchema).schema
export const getPetByIdQueryResponseSchema = z.lazy(() => petSchema)
2 changes: 1 addition & 1 deletion examples/zodios/src/gen/zod/getUserByNameSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ export const getUserByNamePathParamsSchema = z.object({ username: z.string().des
/**
* @description successful operation
*/
export const getUserByNameQueryResponseSchema = z.lazy(() => userSchema).schema
export const getUserByNameQueryResponseSchema = z.lazy(() => userSchema)
4 changes: 2 additions & 2 deletions examples/zodios/src/gen/zod/petSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { z } from 'zod'
export const petSchema = z.object({
id: z.number().optional(),
name: z.string(),
category: z.lazy(() => categorySchema).schema.optional(),
category: z.lazy(() => categorySchema).optional(),
photoUrls: z.array(z.string()),
tags: z.array(z.lazy(() => tagSchema).schema).optional(),
tags: z.array(z.lazy(() => tagSchema)).optional(),
status: z.enum([`available`, `pending`, `sold`]).describe(`pet status in the store`).optional(),
})
4 changes: 2 additions & 2 deletions examples/zodios/src/gen/zod/placeOrderPatchSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { orderSchema } from './orderSchema'
* @description Invalid input
*/
export const placeOrderPatch405Schema = z.any()
export const placeOrderPatchMutationRequestSchema = z.lazy(() => orderSchema).schema
export const placeOrderPatchMutationRequestSchema = z.lazy(() => orderSchema)

/**
* @description successful operation
*/
export const placeOrderPatchMutationResponseSchema = z.lazy(() => orderSchema).schema
export const placeOrderPatchMutationResponseSchema = z.lazy(() => orderSchema)
4 changes: 2 additions & 2 deletions examples/zodios/src/gen/zod/placeOrderSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { orderSchema } from './orderSchema'
* @description Invalid input
*/
export const placeOrder405Schema = z.any()
export const placeOrderMutationRequestSchema = z.lazy(() => orderSchema).schema
export const placeOrderMutationRequestSchema = z.lazy(() => orderSchema)

/**
* @description successful operation
*/
export const placeOrderMutationResponseSchema = z.lazy(() => orderSchema).schema
export const placeOrderMutationResponseSchema = z.lazy(() => orderSchema)
4 changes: 2 additions & 2 deletions examples/zodios/src/gen/zod/updatePetSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export const updatePet405Schema = z.any()
/**
* @description Update an existent pet in the store
*/
export const updatePetMutationRequestSchema = z.lazy(() => petSchema).schema
export const updatePetMutationRequestSchema = z.lazy(() => petSchema)

/**
* @description Successful operation
*/
export const updatePetMutationResponseSchema = z.lazy(() => petSchema).schema
export const updatePetMutationResponseSchema = z.lazy(() => petSchema)
Loading

1 comment on commit 1927d89

@vercel
Copy link

@vercel vercel bot commented on 1927d89 Dec 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

kubb – ./

kubb-kubb.vercel.app
kubb.dev
kubb-git-main-kubb.vercel.app
www.kubb.dev

Please sign in to comment.