New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

joi-to-json

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

joi-to-json - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

19

fixtures/joi-obj-12.1.0.js

@@ -38,3 +38,20 @@ const joi = require('joi-12')

key: joiAllowUnknown.string()
})
}),
dynamicKeyHolder: joi
.object()
.pattern(/s/, joi.object().keys({
id: joi
.number()
.description('Tbe ID for the reference')
.example(123)
.required(),
name: joi
.string()
.allow('', null)
.description('Name of something')
.example('Jack')
.required()
}))
.description('Some kind of list')
.optional()
})

@@ -38,3 +38,20 @@ const joi = require('joi-13')

key: joiAllowUnknown.string()
})
}),
dynamicKeyHolder: joi
.object()
.pattern(/s/, joi.object().keys({
id: joi
.number()
.description('Tbe ID for the reference')
.example(123)
.required(),
name: joi
.string()
.allow('', null)
.description('Name of something')
.example('Jack')
.required()
}))
.description('Some kind of list')
.optional()
})

@@ -38,3 +38,20 @@ const joi = require('joi-14')

key: joiAllowUnknown.string()
})
}),
dynamicKeyHolder: joi
.object()
.pattern(/s/, joi.object().keys({
id: joi
.number()
.description('Tbe ID for the reference')
.example(123)
.required(),
name: joi
.string()
.allow('', null)
.description('Name of something')
.example('Jack')
.required()
}))
.description('Some kind of list')
.optional()
})

@@ -38,3 +38,20 @@ const joi = require('joi-15')

key: joiAllowUnknown.string()
})
}),
dynamicKeyHolder: joi
.object()
.pattern(/s/, joi.object().keys({
id: joi
.number()
.description('Tbe ID for the reference')
.example(123)
.required(),
name: joi
.string()
.allow('', null)
.description('Name of something')
.example('Jack')
.required()
}))
.description('Some kind of list')
.optional()
})

@@ -38,3 +38,20 @@ const joi = require('joi-16')

key: joiAllowUnknown.string()
})
}),
dynamicKeyHolder: joi
.object()
.pattern(/s/, joi.object().keys({
id: joi
.number()
.description('Tbe ID for the reference')
.example(123)
.required(),
name: joi
.string()
.allow('', null)
.description('Name of something')
.example('Jack')
.required()
}))
.description('Some kind of list')
.optional()
})

@@ -38,3 +38,20 @@ const joi = require('joi-17')

key: joi.string()
})
}),
dynamicKeyHolder: joi
.object()
.pattern(/s/, joi.object().keys({
id: joi
.number()
.description('Tbe ID for the reference')
.example(123)
.required(),
name: joi
.string()
.allow('', null)
.description('Name of something')
.example('Jack')
.required()
}))
.description('Some kind of list')
.optional()
})

@@ -155,2 +155,25 @@ {

"additionalProperties": true
},
"dynamicKeyHolder": {
"type": "object",
"additionalProperties": false,
"description": "Some kind of list",
"properties": {
"/s/": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "Tbe ID for the reference",
"examples": [123]
},
"name": {
"type": ["string", "null"],
"description": "Name of something",
"examples": ["Jack"]
}
},
"required": ["id", "name"]
}
}
}

@@ -157,0 +180,0 @@ },

@@ -306,2 +306,31 @@ /* eslint no-use-before-define: 'off' */

})
/**
* For dynamic key scenarios to store the pattern as key
* and have the properties be as with other examples
*/
if (joiDescribe.patterns) {
_.each(joiDescribe.patterns, patternObj => {
if (typeof patternObj.rule !== 'object') {
return
}
schema.properties[patternObj.regex] = {
type: patternObj.rule.type,
properties: {}
}
schema.properties[patternObj.regex].required = []
const childKeys = patternObj.rule.keys || patternObj.rule.children
_.each(childKeys, (ruleObj, key) => {
schema.properties[patternObj.regex].properties[key] = that._convertSchema(ruleObj)
if (that._isRequired(ruleObj)) {
schema.properties[patternObj.regex].required.push(key)
}
})
})
}
if (_.isEmpty(schema.required)) {

@@ -308,0 +337,0 @@ delete schema.required

8

package.json
{
"name": "joi-to-json",
"version": "1.2.0",
"version": "1.3.0",
"description": "joi to JSON Schema Converter",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/kenspirit/joi-to-json.git"
},
"scripts": {

@@ -19,3 +23,3 @@ "lint": "./node_modules/.bin/eslint .",

"dependencies": {
"lodash": "^4.17.15",
"lodash": "^4.17.21",
"semver-compare": "^1.0.0"

@@ -22,0 +26,0 @@ },

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