@anatine/zod-openapi
Advanced tools
Comparing version 2.2.2 to 2.2.3
@@ -5,2 +5,9 @@ # Changelog | ||
### [2.2.3](https://github.com/anatine/zod-plugins/compare/zod-openapi-2.2.2...zod-openapi-2.2.3) (2024-01-23) | ||
### Bug Fixes | ||
* **zod-openapi:** do not mutate original schema with extendApi ([6684ca6](https://github.com/anatine/zod-plugins/commit/6684ca6b54e49afc1ccedc701e9b7e289e2e9b42)) | ||
### [2.2.2](https://github.com/anatine/zod-plugins/compare/zod-openapi-2.2.1...zod-openapi-2.2.2) (2023-12-15) | ||
@@ -7,0 +14,0 @@ |
{ | ||
"name": "@anatine/zod-openapi", | ||
"version": "2.2.2", | ||
"version": "2.2.3", | ||
"description": "Zod to OpenAPI converter", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -7,4 +7,6 @@ "use strict"; | ||
function extendApi(schema, schemaObject = {}) { | ||
schema.metaOpenApi = Object.assign(schema.metaOpenApi || {}, schemaObject); | ||
return schema; | ||
const This = schema.constructor; | ||
const newSchema = new This(schema._def); | ||
newSchema.metaOpenApi = Object.assign({}, schema.metaOpenApi || {}, schemaObject); | ||
return newSchema; | ||
} | ||
@@ -11,0 +13,0 @@ exports.extendApi = extendApi; |
Sorry, the diff of this file is not supported yet
44653
381