Socket
Socket
Sign inDemoInstall

apidoc

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apidoc - npm Package Compare versions

Comparing version 0.20.1 to 0.22.0

template-single/build-single.sh

11

CHANGELOG.md
# apiDoc Changelog
#### 0.22.0
* Fix issue with newer api endpoint showing up on first page load (#869) by @Yopai
* Update Handlebars to latest version (fix security issue) (#867) by @NicolasCARPi
* Allow several path parameters (#866) by @rafaelgssa
* Add param file upload support (#850) by @aqnaruto
#### 0.21.0
* Add --single option to output in a single HTML file (#840) by @eyasliu
#### 0.20.1

@@ -4,0 +15,0 @@

1

example/example.js

@@ -75,2 +75,3 @@ /**

* @apiParam {String} name Name of the User.
* @apiParam {File} avatar Upload avatar.
*

@@ -77,0 +78,0 @@ * @apiUse CreateUserError

@@ -13,4 +13,6 @@ var _ = require('lodash');

template: path.join(__dirname, '../template/'),
templateSingleFile: path.join(__dirname, '../template-single/index.html'),
debug : false,
single : false, // build to single file
silent : false,

@@ -56,4 +58,10 @@ verbose : false,

options.dest = path.join(options.dest, './');
options.template = path.join(options.template, './');
if (options.single) {
options.template = options.templateSingleFile;
options.dest = path.join(options.dest, 'index.html');
} else {
options.template = path.join(options.template, './');
}
// Line-Ending.

@@ -133,5 +141,11 @@ if (options.lineEnding) {

if (app.options.parse !== true)
createOutputFiles(api);
if (app.options.parse !== true) {
if (app.options.single) {
createSingleFile(api);
} else {
createOutputFiles(api);
}
}
if (app.options.verbose) {

@@ -196,4 +210,25 @@ app.log.info('Done.');

function createSingleFile(api) {
if (app.options.simulate)
app.log.warn('!!! Simulation !!! No file or dir will be copied or created.');
// dest is file path, not folder
var dir = path.join(app.options.dest, '..');
app.log.verbose('create dir: ' + dir);
if (!app.options.simulate)
fs.mkdirsSync(dir);
// create target file and setting data
app.log.verbose('generate file: ' + app.options.dest);
fs.writeFileSync(app.options.dest, fs
.readFileSync(app.options.template)
.toString()
.replace('__API_DATA__', api.data)
.replace('__API_PROJECT__', api.project)
);
}
module.exports = {
createDoc: createDoc
};

10

package.json
{
"name": "apidoc",
"version": "0.20.1",
"version": "0.22.0",
"description": "RESTful web API Documentation Generator",

@@ -39,5 +39,6 @@ "author": "Peter Rottmann <rottmann@inveris.de>",

"fs-extra": "^8.1.0",
"handlebars": "^4.7.6",
"lodash": "^4.17.15",
"markdown-it": "^10.0.0",
"nodemon": "^2.0.2",
"nodemon": "^2.0.3",
"winston": "^3.2.1"

@@ -52,6 +53,7 @@ },

"lodash-cli": "^4.17.5",
"mocha": "^6.2.2",
"mocha": "^6.2.3",
"path-to-regexp": "^3.2.0",
"requirejs": "^2.3.6",
"semver": "^6.3.0",
"should": "~13.2.1",
"should": "~13.2.3",
"webfontloader": "^1.6.28"

@@ -58,0 +60,0 @@ },

@@ -15,3 +15,5 @@ require.config({

webfontloader: './vendor/webfontloader',
list: './vendor/list.min'
list: './vendor/list.min',
apiData: './api_data',
apiProject: './api_project',
},

@@ -45,4 +47,4 @@ shim: {

'handlebarsExtended',
'./api_project.js',
'./api_data.js',
'apiProject',
'apiData',
'prettify',

@@ -540,8 +542,10 @@ 'utilsSampleRequest',

// Change Main Version
$('#versions li.version a').on('click', function(e) {
e.preventDefault();
function setMainVersion(selectedVersion) {
if (typeof(selectedVersion) === 'undefined') {
selectedVersion = $('#version strong').html();
}
else {
$('#version strong').html(selectedVersion);
}
var selectedVersion = $(this).html();
$('#version strong').html(selectedVersion);
// hide all

@@ -581,2 +585,9 @@ $('article').addClass('hide');

return;
}
setMainVersion();
$('#versions li.version a').on('click', function(e) {
e.preventDefault();
setMainVersion($(this).html());
});

@@ -583,0 +594,0 @@

@@ -25,2 +25,12 @@ define([

/**
* set paramater type.
*/
Handlebars.registerHelper("setInputType", function(text) {
if (text === "File") {
return "file";
}
return "text";
});
/**
* start/stop timer for simple performance check.

@@ -27,0 +37,0 @@ */

@@ -50,3 +50,8 @@ //this block is used to make this module works with Node (CommonJS module format)

return {handleNestedAndParsingFields};
// Converts path params in the {param} format to the accepted :param format, used before inserting the URL params.
function convertPathParams(url) {
return url.replace(/{(.+?)}/g, ':$1');
}
return {handleNestedAndParsingFields,convertPathParams};
});

@@ -56,4 +56,3 @@ define([

var paramType = {};
var bodyFormData = {};
var bodyFormDataType = {};
var bodyFormData = new FormData();
var bodyJson = '';

@@ -83,4 +82,6 @@ $root.find(".sample-request-param:checked").each(function(i, element) {

header['Content-Type'] = 'multipart/form-data'
bodyFormData[key] = value;
bodyFormDataType[key] = $(element).next().text();
if (element.type == "file") {
value = element.files[0];
}
bodyFormData.append(key,value);
}else {

@@ -98,3 +99,3 @@ param[key] = value;

//Convert {param} form to :param
url = url.replace(/{/,':').replace(/}/,'');
url = utils.convertPathParams(url);

@@ -140,2 +141,7 @@ // Insert url parameter

if(header['Content-Type'] == 'multipart/form-data'){
delete ajaxRequest.headers['Content-Type'];
ajaxRequest.contentType=false;
ajaxRequest.processData=false;
}
$.ajax(ajaxRequest);

@@ -142,0 +148,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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