openapi-fuzzer-core
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "openapi-fuzzer-core", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A library to generate random requests based on open-api specifications.", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
const { klona } = require("klona"); | ||
const HTTP_METHODS = ['get', 'post', 'put', 'patch', 'delete']; | ||
const HTTP_METHODS = ['get', 'post', 'put', 'patch', 'delete', 'head']; | ||
@@ -145,2 +145,3 @@ class Swagger { | ||
for (const value of values) { | ||
if (typeof value === 'number' || typeof value === 'boolean') continue; | ||
this.specs.push({ | ||
@@ -227,8 +228,10 @@ name: 'BODY', | ||
const goldenCopy = this.fakeParameter(parameter); | ||
for (const property of Object.keys(properties)) { | ||
const fuzzValues = this.fuzzParameter(properties[property], nonPrimitives); | ||
for (const fuzzValue of fuzzValues) { | ||
const fake = klona(goldenCopy); | ||
fake[property] = fuzzValue; | ||
values.push(fake); | ||
if (properties) { | ||
for (const property of Object.keys(properties)) { | ||
const fuzzValues = this.fuzzParameter(properties[property], nonPrimitives); | ||
for (const fuzzValue of fuzzValues) { | ||
const fake = klona(goldenCopy); | ||
fake[property] = fuzzValue; | ||
values.push(fake); | ||
} | ||
} | ||
@@ -248,3 +251,3 @@ } | ||
let fake; | ||
const properties = parameter.properties; | ||
const { example, properties } = parameter; | ||
switch (parameter.type) { | ||
@@ -262,4 +265,8 @@ case 'integer': | ||
fake = {}; | ||
for (const property of Object.keys(properties)) { | ||
fake[property] = this.fakeParameter(properties[property]); | ||
if (properties) { | ||
for (const property of Object.keys(properties)) { | ||
fake[property] = this.fakeParameter(properties[property]); | ||
} | ||
} else if (example) { | ||
fake = example; | ||
} | ||
@@ -266,0 +273,0 @@ return fake; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
11008
283
0