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 2.2.1 to 2.2.2

2

CHANGELOG.md

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

### [2.2.2](https://github.com/anatine/zod-plugins/compare/zod-openapi-2.2.1...zod-openapi-2.2.2) (2023-12-15)
### [2.2.1](https://github.com/anatine/zod-plugins/compare/zod-openapi-2.2.0...zod-openapi-2.2.1) (2023-10-31)

@@ -7,0 +9,0 @@

2

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

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

@@ -172,10 +172,12 @@ "use strict";

return (0, ts_deepmerge_1.default)({
type: 'string',
format: 'null',
nullable: true,
type: 'null',
}, zodRef.description ? { description: zodRef.description } : {}, ...schemas);
}
function parseOptionalNullable({ schemas, zodRef, useOutput, }) {
function parseOptional({ schemas, zodRef, useOutput, }) {
return (0, ts_deepmerge_1.default)(generateSchema(zodRef.unwrap(), useOutput), zodRef.description ? { description: zodRef.description } : {}, ...schemas);
}
function parseNullable({ schemas, zodRef, useOutput, }) {
const schema = generateSchema(zodRef.unwrap(), useOutput);
return (0, ts_deepmerge_1.default)(Object.assign(Object.assign({}, schema), { type: [schema.type, 'null'] }), zodRef.description ? { description: zodRef.description } : {}, ...schemas);
}
function parseDefault({ schemas, zodRef, useOutput, }) {

@@ -258,2 +260,5 @@ return (0, ts_deepmerge_1.default)(Object.assign({ default: zodRef._def.defaultValue() }, generateSchema(zodRef._def.innerType, useOutput)), zodRef.description ? { description: zodRef.description } : {}, ...schemas);

}
function parseReadonly({ zodRef, useOutput, schemas, }) {
return (0, ts_deepmerge_1.default)(generateSchema(zodRef._def.innerType, useOutput), zodRef.description ? { description: zodRef.description } : {}, ...schemas);
}
const workerMap = {

@@ -268,4 +273,4 @@ ZodObject: parseObject,

ZodNull: parseNull,
ZodOptional: parseOptionalNullable,
ZodNullable: parseOptionalNullable,
ZodOptional: parseOptional,
ZodNullable: parseNullable,
ZodDefault: parseDefault,

@@ -295,2 +300,3 @@ ZodArray: parseArray,

ZodPipeline: parsePipeline,
ZodReadonly: parseReadonly,
};

@@ -300,3 +306,2 @@ function generateSchema(zodRef, useOutput) {

const schemas = [
zodRef.isNullable && zodRef.isNullable() ? { nullable: true } : {},
...(Array.isArray(metaOpenApi) ? metaOpenApi : [metaOpenApi]),

@@ -303,0 +308,0 @@ ];

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