How to use the resume-schema.validate function in resume-schema

To help you get started, we’ve selected a few resume-schema examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mblarsen / resume-linkedin / index.js View on Github external
linkedIn.people.me(function(err, $in) {
      req.session.$in = $in;
      resume = makeResume($in);
      resumeSchema.validate(resume, function (result, validationErr) {
        var exitCode = 0;
        if (validationErr || result.valid !== true) {
          console.error(validationErr);
          console.error(result);
          exitCode = 1;
        } else {
          var resumeString = JSON.stringify(resume, undefined, 2);
          log('saving file resume.json:' + resumeString.length);
          fs.writeFileSync(__dirname + '/resume.json', resumeString);
          console.log('Done!');
        }
        res.render('index', { accessToken: req.session.accessToken, resume: resume, result: result });
        process.exit(exitCode);
      });
    });
  } else {
github jsonresume / resume-cli / validate.js View on Github external
function validate(resumeData, callback) {
    resumeSchema.validate(resumeData, function(report, errs) {
        if (errs) {
            console.log('TEST FAILED'.red);
            errorFormatter(errs);
            process.exit();
        } else {
            console.log('TEST SUCCESSFUL'.green);
            console.log('Number of errors:'.cyan, report.errors.length);
            console.log('To publish your resume at'.cyan, 'http://jsonresume.org', 'simply type the command'.cyan, 'node index publish (resume publish)');
            process.exit();
        }
    });
}
module.exports = {
github jsonresume / resume-cli / publish.js View on Github external
function publish(resumeData, force) {
    resumeSchema.validate(resumeData, function(report, errs) {
        if (errs && !force) {
            console.log('Error: Resume failed to publish.'.red);
            console.log('Reasons:');
            console.log(validate.errorFormatter(errs));
            console.log('For error troubleshooting type:'.cyan, 'node index test');
            console.log('Or to try publish regardless of the error warning, type:'.cyan, 'node publish --force');
            process.exit();
        } else {
            if (force) {
                console.log('You resume.json did not pass formatting tests. Attempting to publish anyway...'.yellow);
            }
            console.log('publishing...');
            publishSend(resumeData);
        }
    });
}
github jsonresume / theme-manager / lib / theme.js View on Github external
fs.readFileAsync(path.join(root, themeDirectory, 'package.json'), 'utf8').then(function (themePackageJson) {
        var output = '';
        output += 'Theme returned an error.';
        output += '<pre>';
        output += error.stack;
        output += '</pre>';
        output += '<h3>Theme Info</h3>';
        output += '<pre>';
        output += themePackageJson;
        output += '</pre>';
        output += '<p><strong>We just launched the official 0.0.0 version recently, please make sure you update before continuing.</strong></p>';
        output += '<h3>Resume.json Validation Test</h3>';
        delete options.resume._id;
        delete options.resume.jsonresume;
        delete options.resume.profiles;
        schema.validate(options.resume, function(blah, err) {
          output += '<pre>';
          output += JSON.stringify(err, undefined, 4);
          output += '</pre>';
          res.send(output)
        })
      });
    })

resume-schema

JSON Resume Schema

MIT
Latest version published 6 months ago

Package Health Score

71 / 100
Full package analysis

Similar packages