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

@mikaello/avrodoc-plus

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mikaello/avrodoc-plus - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

2

package.json
{
"name": "@mikaello/avrodoc-plus",
"description": "Documentation tool for Avro schemas. Forked from https://github.com/leosilvadev/avrodoc-plus.",
"version": "1.0.2",
"version": "1.1.0",
"author": "mikaello https://github.com/mikaello",

@@ -6,0 +6,0 @@ "type": "module",

@@ -19,13 +19,19 @@ /**

*/
async function createAvroDoc(extra_less_files, inputfiles, outputfile) {
async function createAvroDoc(
extra_less_files,
inputfiles,
outputfile,
ignoreInvalid
) {
avrodocDebug(`Creating ${outputfile} from `, inputfiles);
let schemata = inputfiles.map(function (filename) {
return {
json: readJSON(filename),
filename: filename,
};
});
let schemata = inputfiles
.map((filename) => {
const json = readJSON(filename, ignoreInvalid);
return json != null ? { json, filename } : null;
})
.filter((s) => s != null);
const html = await topLevelHTML(extra_less_files, {
inline: true,
schemata: schemata,
schemata,
});

@@ -54,5 +60,6 @@ return await writeAvroDoc(outputfile, html);

* @param {string} filename to be read
* @param {boolean} ignoreInvalid should we ignore invalid JSON files
* @returns {object} with parsed AVRO
*/
function readJSON(filename) {
function readJSON(filename, ignoreInvalid) {
let json, parsed;

@@ -64,3 +71,6 @@ avrodocDebug("Parsing ", filename);

} catch (e) {
console.error("Not a valid json file: " + filename);
console.error("Not a valid JSON file: " + filename);
if (ignoreInvalid) {
return;
}
process.exit(1);

@@ -67,0 +77,0 @@ }

@@ -28,2 +28,4 @@ /**

"-s": "--style",
"--ignore-invalid": Boolean,
});

@@ -33,2 +35,3 @@

let outputFile = null;
let ignoreInvalidSchemas = false;

@@ -51,10 +54,14 @@ // Determine list of input files file1.avsc file2.avsc

if (argv["--ignore-invalid"]) {
ignoreInvalidSchemas = true;
}
//valid input?
if (!inputFiles || inputFiles.length === 0 || outputFile === null) {
console.error(
"Usage: avrodoc [-i rootfolder] [my-schema.avsc [another-schema.avsc...]] [-o my-documentation.html] [-s my-style.less]"
"Usage: avrodoc [-i rootfolder] [my-schema.avsc [another-schema.avsc...]] [-o my-documentation.html] [-s my-style.less] [--ignore-invalid]"
);
process.exit(1);
}
createAvroDoc(extra_less_files, inputFiles, outputFile);
createAvroDoc(extra_less_files, inputFiles, outputFile, ignoreInvalidSchemas);

@@ -61,0 +68,0 @@ //private stuff

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