openapi-format
Advanced tools
Comparing version 1.7.1 to 1.7.2
@@ -279,4 +279,4 @@ #!/usr/bin/env node | ||
// Register components presence | ||
if (get(this,'parent.parent.key') && this.parent.parent.key === 'components') { | ||
if (get(this,'parent.key') && this.parent.key && comps[this.parent.key]) { | ||
if (get(this, 'parent.parent.key') && this.parent.parent.key === 'components') { | ||
if (get(this, 'parent.key') && this.parent.key && comps[this.parent.key]) { | ||
comps[this.parent.key][this.key] = {...comps[this.parent.key][this.key], present: true}; | ||
@@ -368,3 +368,3 @@ comps.meta.total = comps.meta.total++; | ||
// HACK to overcome the issue with removing items from an array | ||
if (get(this,'parent.parent.key') && this.parent.parent.key === 'x-tagGroups') { | ||
if (get(this, 'parent.parent.key') && this.parent.parent.key === 'x-tagGroups') { | ||
// debugFilterStep = 'Filter -x-tagGroups - flagValues - array value' | ||
@@ -400,3 +400,3 @@ const tagGroup = this.parent.node | ||
// HACK to overcome the issue with removing items from an array | ||
if (get(this,'parent.parent.key') && this.parent.parent.key === 'x-tagGroups') { | ||
if (get(this, 'parent.parent.key') && this.parent.parent.key === 'x-tagGroups') { | ||
// debugFilterStep = 'Filter -x-tagGroups - flagValues - single value' | ||
@@ -437,2 +437,9 @@ const tagGroup = this.parent.node | ||
// Filter out operations not matching inverseFilterArray | ||
if (inverseFilterArray.length > 0 && this.parent && this.parent.parent && this.parent.parent.key === 'paths') { | ||
if ((node.tags === undefined || !inverseFilterArray.some(i => node.tags.includes(i)))) { | ||
this.delete(); | ||
} | ||
} | ||
// Filter out OpenApi.tags & OpenApi.x-tagGroups matching the flags | ||
@@ -470,13 +477,13 @@ if ((this.key === 'tags' || this.key === 'x-tagGroups') && this.parent.key === undefined && Array.isArray(node)) { | ||
if (stripUnused.length > 0) { | ||
unusedComp.schemas = Object.keys(comps.schemas || {}).filter(key => !get(comps,`schemas[${key}].used`)); //comps.schemas[key]?.used); | ||
unusedComp.schemas = Object.keys(comps.schemas || {}).filter(key => !get(comps, `schemas[${key}].used`)); //comps.schemas[key]?.used); | ||
options.unusedComp.schemas = [...options.unusedComp.schemas, ...unusedComp.schemas]; | ||
unusedComp.responses = Object.keys(comps.responses || {}).filter(key => !get(comps,`responses[${key}].used`));//!comps.responses[key]?.used); | ||
unusedComp.responses = Object.keys(comps.responses || {}).filter(key => !get(comps, `responses[${key}].used`));//!comps.responses[key]?.used); | ||
options.unusedComp.responses = [...options.unusedComp.responses, ...unusedComp.responses]; | ||
unusedComp.parameters = Object.keys(comps.parameters || {}).filter(key => !get(comps,`parameters[${key}].used`));//!comps.parameters[key]?.used); | ||
unusedComp.parameters = Object.keys(comps.parameters || {}).filter(key => !get(comps, `parameters[${key}].used`));//!comps.parameters[key]?.used); | ||
options.unusedComp.parameters = [...options.unusedComp.parameters, ...unusedComp.parameters]; | ||
unusedComp.examples = Object.keys(comps.examples || {}).filter(key => !get(comps,`examples[${key}].used`));//!comps.examples[key]?.used); | ||
unusedComp.examples = Object.keys(comps.examples || {}).filter(key => !get(comps, `examples[${key}].used`));//!comps.examples[key]?.used); | ||
options.unusedComp.examples = [...options.unusedComp.examples, ...unusedComp.examples]; | ||
unusedComp.requestBodies = Object.keys(comps.requestBodies || {}).filter(key => !get(comps,`requestBodies[${key}].used`));//!comps.requestBodies[key]?.used); | ||
unusedComp.requestBodies = Object.keys(comps.requestBodies || {}).filter(key => !get(comps, `requestBodies[${key}].used`));//!comps.requestBodies[key]?.used); | ||
options.unusedComp.requestBodies = [...options.unusedComp.requestBodies, ...unusedComp.requestBodies]; | ||
unusedComp.headers = Object.keys(comps.headers || {}).filter(key => !get(comps,`headers[${key}].used`));//!comps.headers[key]?.used); | ||
unusedComp.headers = Object.keys(comps.headers || {}).filter(key => !get(comps, `headers[${key}].used`));//!comps.headers[key]?.used); | ||
options.unusedComp.headers = [...options.unusedComp.headers, ...unusedComp.headers]; | ||
@@ -483,0 +490,0 @@ unusedComp.meta.total = unusedComp.schemas.length + unusedComp.responses.length + unusedComp.parameters.length + unusedComp.examples.length + unusedComp.requestBodies.length + unusedComp.headers.length |
{ | ||
"name": "openapi-format", | ||
"version": "1.7.1", | ||
"version": "1.7.2", | ||
"description": "Format an OpenAPI document by ordering and filtering fields.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
69777
855