Comparing version 1.0.4 to 2.0.1
@@ -14,4 +14,4 @@ const Enjoi = require('enjoi'); | ||
module.exports = filePath => { | ||
const docSchemas = getSchemas(filePath); | ||
module.exports = async filePath => { | ||
const docSchemas = await getSchemas(filePath); | ||
@@ -18,0 +18,0 @@ const joiSchemas = {}; |
@@ -1,7 +0,5 @@ | ||
const { readFileSync } = require('fs'); | ||
const { safeLoad } = require('js-yaml'); | ||
const SwaggerParser = require('swagger-parser'); | ||
const getSchemas = filePath => { | ||
const openapi = readFileSync(filePath, 'utf8'); | ||
const doc = safeLoad(openapi); | ||
const getSchemas = async filePath => { | ||
const doc = await SwaggerParser.dereference(filePath); | ||
@@ -8,0 +6,0 @@ return doc.components.schemas; |
{ | ||
"name": "oas2joi", | ||
"version": "1.0.4", | ||
"version": "2.0.1", | ||
"description": "Create a Joi schema from an Open API Specification", | ||
@@ -19,6 +19,7 @@ "main": "index.js", | ||
"enjoi": "^6.0.0", | ||
"js-yaml": "^3.10.0" | ||
"swagger-parser": "^9.0.1" | ||
}, | ||
"devDependencies": { | ||
"@hapi/joi": "^15.0.3", | ||
"contributor-faces": "^1.0.3", | ||
"jest": "^24.8.0", | ||
@@ -25,0 +26,0 @@ "pre-commit": "^1.2.2" |
@@ -23,1 +23,9 @@ # oas2joi | ||
``` | ||
## Contributors | ||
[//]: contributor-faces | ||
<a href="https://github.com/iudex-"><img src="https://avatars2.githubusercontent.com/u/56843?s=400&u=598e754a7f053479c93a4ac061b5abfe0a6a7df1&v=4" title="iudex-" width="80" height="80"></a> | ||
<a href="https://github.com/JoeScho"><img src="https://avatars1.githubusercontent.com/u/12475501?s=460&u=ea1487bb0b85777ae539a986d4254d6964d1c9d7&v=4" title="JoeScho" width="80" height="80"></a> | ||
[//]: contributor-faces |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
3521
31
0
4
54
+ Addedswagger-parser@^9.0.1
+ Added@apidevtools/json-schema-ref-parser@8.0.0(transitive)
+ Added@apidevtools/openapi-schemas@2.1.0(transitive)
+ Added@apidevtools/swagger-methods@3.0.2(transitive)
+ Added@apidevtools/swagger-parser@9.0.1(transitive)
+ Added@jsdevtools/ono@7.1.3(transitive)
+ Addedcall-me-maybe@1.0.2(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedlodash.get@4.4.2(transitive)
+ Addedlodash.isequal@4.5.0(transitive)
+ Addedopenapi-types@1.3.5(transitive)
+ Addedswagger-parser@9.0.1(transitive)
+ Addedvalidator@13.12.0(transitive)
+ Addedz-schema@4.2.4(transitive)
- Removedjs-yaml@^3.10.0