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

oas-normalize

Package Overview
Dependencies
Maintainers
7
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oas-normalize - npm Package Compare versions

Comparing version 0.0.6 to 0.1.0

.github/workflows/nodejs.yml

16

lib/utils.js

@@ -6,3 +6,3 @@ const YAML = require('yamljs');

// YAML or JSON string to JSON Object
stringToJSON: (string) => {
stringToJSON: string => {
if (typeof string === 'object') {

@@ -17,3 +17,3 @@ return deepClone({}, string);

type: (obj) => {
type: obj => {
if (module.exports.isBuffer(obj)) {

@@ -27,3 +27,4 @@ return 'buffer';

}
if (obj.match(/\n/)) { // Not sure about this...
if (obj.match(/\n/)) {
// Not sure about this...
return 'string-yaml';

@@ -40,6 +41,9 @@ }

version: (schema) => schema.swagger || schema.openapi,
version: schema => schema.swagger || schema.openapi,
isBuffer: (obj) => obj != null && obj.constructor != null
&& typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj),
isBuffer: obj =>
obj != null &&
obj.constructor != null &&
typeof obj.constructor.isBuffer === 'function' &&
obj.constructor.isBuffer(obj),
};

@@ -14,5 +14,8 @@ const r2 = require('r2');

this.file = file;
this.opts = deepClone({
enablePaths: false,
}, opts);
this.opts = deepClone(
{
enablePaths: false,
},
opts,
);
this.type = utils.type(this.file);

@@ -31,3 +34,3 @@

const success = (obj) => {
const success = obj => {
const ret = utils.stringToJSON(obj);

@@ -34,0 +37,0 @@ this.f_load = ret;

{
"name": "oas-normalize",
"version": "0.0.6",
"version": "0.1.0",
"description": "Swagger 2 or OAS 3? YAML or JSON? URL, path, string or object? Who cares! It just works.",

@@ -14,3 +14,5 @@ "main": "oas.js",

"scripts": {
"lint": "eslint -f unix .",
"lint": "eslint .",
"pretest": "npm run lint && npm run prettier",
"prettier": "prettier --list-different --write \"./**/**.{js,jsx}\"",
"test": "jest --coverage"

@@ -28,7 +30,8 @@ },

"devDependencies": {
"@readme/eslint-config": "^1.5.1",
"eslint": "^6.4.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.18.2",
"jest": "^24.9.0"
"eslint-plugin-jest": "^23.0.4",
"jest": "^24.9.0",
"prettier": "^1.19.1"
}
}
const swagger = require('swagger-parser');
module.exports = (el, cb) => {
swagger.validate(el.out.deref, (err) => {
swagger.validate(el.out.deref, err => {
if (err) {
if (err.details && err.details.length) {
return cb({
errors: [{
message: err.details[0].message,
path: err.details[0].path,
}],
errors: [
{
message: err.details[0].message,
path: err.details[0].path,
},
],
full: err,

@@ -16,5 +18,7 @@ });

return cb({
errors: [{
message: err.message.replace(/\[object Object\]/g, 'Schema'),
}],
errors: [
{
message: err.message.replace(/\[object Object\]/g, 'Schema'),
},
],
full: err,

@@ -21,0 +25,0 @@ });

@@ -7,5 +7,7 @@ const validator = require('swagger2openapi/validate.js');

return cb({
errors: [{
message: err.message,
}],
errors: [
{
message: err.message,
},
],
full: err,

@@ -12,0 +14,0 @@ });

Sorry, the diff of this file is not supported yet

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