asteasolutions / zod-to-openapi

A library that generates OpenAPI (Swagger) docs from Zod schemas
MIT License
997 stars 61 forks source link

need to add request body parameters without body object #226

Closed gautam-paladiya closed 7 months ago

gautam-paladiya commented 7 months ago

request: { body: { content: { 'application/json': { schema: CreateJobSchema } } } }, is being converted to { "body": { "customerName": "string", } }

gautam-paladiya commented 7 months ago

its was due to export const CreateJobSchema = z .object({ body: customerFields.merge(deviceFields).merge(logisticAndOtherFields), }) .openapi('CreateJobInput')