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

swagger-jsdoc

Package Overview
Dependencies
Maintainers
4
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swagger-jsdoc - npm Package Compare versions

Comparing version 6.1.0 to 6.2.0

12

package.json
{
"name": "swagger-jsdoc",
"description": "Generates swagger doc based on JSDoc",
"version": "6.1.0",
"version": "6.2.0",
"engines": {

@@ -29,11 +29,11 @@ "node": ">=12.0.0"

"body-parser": "1.19.0",
"eslint": "7.14.0",
"eslint-config-airbnb-base": "14.2.1",
"eslint": "8.9.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-prettier": "6.15.0",
"eslint-loader": "4.0.2",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jest": "^24.1.0",
"eslint-plugin-import": "2.25.4",
"eslint-plugin-jest": "26.1.1",
"eslint-plugin-prettier": "3.1.4",
"express": "4.17.1",
"husky": "4.3.0",
"husky": "7.0.4",
"jest": "^26.6.1",

@@ -40,0 +40,0 @@ "lint-staged": "10.5.2",

@@ -8,2 +8,3 @@ const { build } = require('./specification');

* @param {boolean} options.failOnErrors Whether or not to throw when parsing errors. Defaults to false.
* @param {boolean} options.verbose Whether the swagger snippet containing each error should be included in print/throws. Defaults to false.
* @param {string} options.format Optional, defaults to '.json' - target file format '.yml' or '.yaml'.

@@ -10,0 +11,0 @@ * @param {object} options.swaggerDefinition

@@ -38,2 +38,3 @@ const doctrine = require('doctrine');

'components',
'channels',
],

@@ -140,2 +141,3 @@ };

'definitions',
'channels',
];

@@ -192,3 +194,5 @@ if (commonProperties.includes(property)) {

for (const annotation of yamlAnnotations) {
const parsed = YAML.parseDocument(annotation);
const parsed = Object.assign(YAML.parseDocument(annotation), {
filePath,
});

@@ -201,2 +205,6 @@ const anchors = parsed.anchors.getNames();

} else if (parsed.errors && parsed.errors.length) {
// Attach the relevent yaml section to the error for verbose logging
parsed.errors.forEach((err) => {
err.annotation = annotation;
});
yamlDocsErrors.push(parsed);

@@ -213,3 +221,3 @@ } else {

for (const doc of extractYamlFromJsDoc(jsDocComment)) {
const parsed = YAML.parseDocument(doc);
const parsed = Object.assign(YAML.parseDocument(doc), { filePath });

@@ -222,2 +230,6 @@ const anchors = parsed.anchors.getNames();

} else if (parsed.errors && parsed.errors.length) {
// Attach the relevent yaml section to the error for verbose logging
parsed.errors.forEach((err) => {
err.annotation = doc;
});
yamlDocsErrors.push(parsed);

@@ -264,4 +276,21 @@ } else {

// Format errors into a printable/throwable string
const errReport = yamlDocsErrors
.map(({ errors }) => errors.join('\n'))
.map(({ errors, filePath }) => {
let str = `Error in ${filePath} :\n`;
if (options.verbose) {
str += errors
.map(
(e) =>
`${e.toString()}\nImbedded within:\n\`\`\`\n ${e.annotation.replace(
/\n/g,
'\n '
)}\n\`\`\``
)
.join('\n');
} else {
str += errors.map((e) => e.toString()).join('\n');
}
return str;
})
.filter((error) => !!error);

@@ -268,0 +297,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