-
-
Notifications
You must be signed in to change notification settings - Fork 529
Closed
Labels
help wantedExtra attention is neededExtra attention is neededworkaroundA workaround has been providedA workaround has been providedzodZod related issueZod related issue
Milestone
Description
The output Zod schema has optional added to it.
Is my OpenAPI definition incorrect?
orval: 7.11.2
zod: 4.0.11
paths:
/api/v1/users:
post:
operationId: createUser
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/UserCreate' }
responses:
...
components:
schemas:
User:
type: object
properties:
email:
type: string
format: email
maxLength: 255
description: email
name:
type: string
maxLength: 255
description: name
UserCreate:
allOf:
- $ref: "#/components/schemas/User"
- type: object
required:
- email
- name
The output zod schema has optional
export const createUserBody = zod.object({
"email": zod.email().max(createUserBodyEmailMax).optional().describe('email'),
"name": zod.string().max(createUserBodyNameMax).optional().describe('name')
}).and(zod.object({
}))
The output typescript schema does not have optional
export type UserCreate = User & UserCreateAllOf & Required<Pick<User & UserCreateAllOf, 'username' | 'name'>>;
clarkjohnd and alexmarqs
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is neededworkaroundA workaround has been providedA workaround has been providedzodZod related issueZod related issue