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

joi-to-swagger

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

joi-to-swagger - npm Package Compare versions

Comparing version 6.0.1 to 6.1.0

22

index.js

@@ -262,2 +262,3 @@ 'use strict';

const properties = {};
let additionalProperties = {};

@@ -285,2 +286,17 @@ const combinedComponents = merge({}, existingComponents || {}, newComponentsByRef || {});

if (!children.length) {
const keyPatterns = get(schema, '$_terms.patterns');
if (keyPatterns) {
keyPatterns.forEach((pattern) => {
if (pattern.rule) {
const { swagger } = parse(pattern.rule, combinedComponents);
if (!swagger) { // swagger is falsy if joi.forbidden()
return;
}
additionalProperties = swagger;
}
});
}
}
const swagger = {

@@ -298,2 +314,6 @@ type: 'object',

if (Object.keys(additionalProperties).length !== 0) {
swagger.additionalProperties = additionalProperties;
}
return swagger;

@@ -372,4 +392,2 @@ },

if (!swagger) return { swagger, components };
if (schema._valids && schema._valids.has(null)) {

@@ -376,0 +394,0 @@ swagger.nullable = true;

14

package.json
{
"name": "joi-to-swagger",
"version": "6.0.1",
"version": "6.1.0",
"description": "Conversion library for transforming joi schema objects into swagger / OpenApi OAS 3.0 schema definitions.",

@@ -11,3 +11,3 @@ "main": "index.js",

"test:debug": "tap --node-arg=--inspect --no-timeout tests.js",
"test:travis": "tap --reporter=tap tests.js",
"test:ci": "tap --reporter=tap tests.js",
"lint": "eslint ./"

@@ -33,9 +33,9 @@ },

"devDependencies": {
"eslint": "^7.6.0",
"eslint": "^7.32.0",
"eslint-config-twipped": "~3.4.0",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-promise": "^4.2.1",
"joi": "^17.2.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.0.0",
"joi": "^17.6.0",
"@joi/date": "^2.1.0",
"tap": "^15.0.9",
"tap": "^16.3.0",
"tapsuite": "^2.0.1"

@@ -42,0 +42,0 @@ },

@@ -5,4 +5,3 @@ joi-to-swagger

[![npm](https://img.shields.io/npm/v/joi-to-swagger.svg?logo=npm)](https://www.npmjs.com/package/joi-to-swagger)
[![travis](https://img.shields.io/travis/Twipped/joi-to-swagger/master.svg?label=tests&logo=travis-ci)](https://travis-ci.org/Twipped/joi-to-swagger)
[![Dependency Status](https://img.shields.io/david/Twipped/joi-to-swagger.svg?style=flat-square)](https://david-dm.org/Twipped/joi-to-swagger)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/Twipped/joi-to-swagger/Node.js%20Testing?label=tests)
[![Download Status](https://img.shields.io/npm/dm/joi-to-swagger.svg?style=flat-square)](https://www.npmjs.com/package/joi-to-swagger)

@@ -77,2 +76,3 @@

- `.required()` on object members produces a `"required": []` array
- `.pattern(pattern, JoiSchema)` -> `additionalProperties: [Schema]`

@@ -79,0 +79,0 @@ - `joi.array().items()` - in case of multiple provided schemas using `items()` method, the "oneOf" (OAS3) keyword is used

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