Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@anatine/zod-openapi

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@anatine/zod-openapi - npm Package Compare versions

Comparing version 1.11.1 to 1.12.0

12

CHANGELOG.md

@@ -5,2 +5,14 @@ # Changelog

## [1.12.0](https://github.com/anatine/zod-plugins/compare/zod-openapi-1.11.1...zod-openapi-1.12.0) (2023-01-17)
### Features
* set additionalProperties to false if strict ([80c7012](https://github.com/anatine/zod-plugins/commit/80c7012922bb4b1a59a5b96d0b5680e7cc436976))
### Bug Fixes
* **zod-openapi:** no empty required to conform to OpenApi 3.0 ([5d7731e](https://github.com/anatine/zod-plugins/commit/5d7731e3ae8b457664f2a750274005d0a5a50f7f))
### [1.11.1](https://github.com/anatine/zod-plugins/compare/zod-openapi-1.11.0...zod-openapi-1.11.1) (2023-01-01)

@@ -7,0 +19,0 @@

2

package.json
{
"name": "@anatine/zod-openapi",
"version": "1.11.1",
"version": "1.12.0",
"description": "Zod to OpenAPI converter",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -121,15 +121,19 @@ "use strict";

additionalProperties = true;
else if (zodRef._def.unknownKeys === 'strict')
additionalProperties = false;
// So that `undefined` values don't end up in the schema and be weird
additionalProperties = additionalProperties ? { additionalProperties } : {};
return (0, ts_deepmerge_1.default)(Object.assign({ type: 'object', properties: iterateZodObject({
additionalProperties = additionalProperties != null ? { additionalProperties } : {};
const requiredProperties = Object.keys(zodRef.shape).filter((key) => {
const item = zodRef.shape[key];
return (!(item.isOptional() ||
item instanceof zod_1.z.ZodDefault ||
item._def.typeName === 'ZodDefault') &&
!(item instanceof zod_1.z.ZodNever || item._def.typeName === 'ZodDefault'));
});
const required = requiredProperties.length > 0 ? { required: requiredProperties } : {};
return (0, ts_deepmerge_1.default)(Object.assign(Object.assign({ type: 'object', properties: iterateZodObject({
zodRef: zodRef,
schemas,
useOutput,
}), required: Object.keys(zodRef.shape).filter((key) => {
const item = zodRef.shape[key];
return (!(item.isOptional() ||
item instanceof zod_1.z.ZodDefault ||
item._def.typeName === 'ZodDefault') &&
!(item instanceof zod_1.z.ZodNever || item._def.typeName === 'ZodDefault'));
}) }, additionalProperties), zodRef.description ? { description: zodRef.description } : {}, ...schemas);
}) }, required), additionalProperties), zodRef.description ? { description: zodRef.description } : {}, ...schemas);
}

@@ -136,0 +140,0 @@ function parseRecord({ zodRef, schemas, useOutput, }) {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc