@ts-rest/open-api
Advanced tools
Comparing version 3.9.0 to 3.10.0
64
index.js
@@ -62,13 +62,24 @@ import { isAppRoute, isZodObject } from '@ts-rest/core'; | ||
const responseSchema = getJsonSchemaFromZod(path.route.responses[keyAsNumber]); | ||
return Object.assign(Object.assign({}, acc), { [keyAsNumber]: Object.assign({ description: `${keyAsNumber}` }, (responseSchema | ||
? { | ||
content: { | ||
'application/json': { | ||
schema: responseSchema, | ||
return { | ||
...acc, | ||
[keyAsNumber]: { | ||
description: `${keyAsNumber}`, | ||
...(responseSchema | ||
? { | ||
content: { | ||
'application/json': { | ||
schema: responseSchema, | ||
}, | ||
}, | ||
}, | ||
} | ||
: {})) }); | ||
} | ||
: {}), | ||
}, | ||
}; | ||
}, {}); | ||
const newPath = Object.assign(Object.assign(Object.assign({ description: path.route.description, summary: path.route.summary, deprecated: path.route.deprecated, tags: path.paths, parameters: [ | ||
const newPath = { | ||
description: path.route.description, | ||
summary: path.route.summary, | ||
deprecated: path.route.deprecated, | ||
tags: path.paths, | ||
parameters: [ | ||
...(paramsFromPath | ||
@@ -90,20 +101,31 @@ ? paramsFromPath.map((param) => ({ | ||
: []), | ||
] }, (options.setOperationId ? { operationId: path.id } : {})), (bodySchema | ||
? { | ||
requestBody: { | ||
description: 'Body', | ||
content: { | ||
'application/json': { | ||
schema: bodySchema, | ||
], | ||
...(options.setOperationId ? { operationId: path.id } : {}), | ||
...(bodySchema | ||
? { | ||
requestBody: { | ||
description: 'Body', | ||
content: { | ||
'application/json': { | ||
schema: bodySchema, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
: {})), { responses }); | ||
acc[path.path] = Object.assign(Object.assign({}, acc[path.path]), { [mapMethod[path.route.method]]: newPath }); | ||
} | ||
: {}), | ||
responses, | ||
}; | ||
acc[path.path] = { | ||
...acc[path.path], | ||
[mapMethod[path.route.method]]: newPath, | ||
}; | ||
return acc; | ||
}, {}); | ||
return Object.assign({ openapi: '3.0.0', paths: pathObject }, apiDoc); | ||
return { | ||
openapi: '3.0.0', | ||
paths: pathObject, | ||
...apiDoc, | ||
}; | ||
}; | ||
export { generateOpenApi }; |
{ | ||
"name": "@ts-rest/open-api", | ||
"version": "3.9.0", | ||
"version": "3.10.0", | ||
"peerDependenciesMeta": { | ||
@@ -17,3 +17,3 @@ "zod": { | ||
"zod-to-json-schema": "^3.x.x", | ||
"@ts-rest/core": "3.9.0" | ||
"@ts-rest/core": "3.10.0" | ||
}, | ||
@@ -20,0 +20,0 @@ "module": "./index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11356
266