openapi-format
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -192,5 +192,4 @@ #!/usr/bin/env node | ||
} else { | ||
if(this.path[0] === 'components' && this.path[1] === 'examples' && this.path[3] === 'value') { | ||
if (this.path[0] === 'components' && this.path[1] === 'examples' && this.path[3] === 'value') { | ||
// debugStep = 'Generic sorting - skip nested components>examples' | ||
// debugStep = 'Generic sorting - skip nested components>examples' | ||
// Skip nested components>examples values | ||
@@ -316,9 +315,11 @@ } else { | ||
// Filter out OpenApi.tags matching the flags | ||
if (this.parent && this.parent && this.key === 'tags' && this.parent.key === undefined && Array.isArray(node)) { | ||
// debugFilterStep = 'Filter - tag flags' | ||
// Deep filter array of tags | ||
let oaTags = JSON.parse(JSON.stringify(node)); // Deep copy of the object | ||
const oaFilteredTags = oaTags.filter(item => !filterProps.some(i => (Object.keys(item).includes(i)))); | ||
this.update(oaFilteredTags); | ||
// Filter out OpenApi.tags & OpenApi.x-tagGroups matching the flags | ||
if ((this?.key === 'tags' || this?.key === 'x-tagGroups') && this?.parent.key === undefined && Array.isArray(node)) { | ||
if (filterProps.length > 0) { | ||
// debugFilterStep = 'Filter - tag/x-tagGroup - flags' | ||
// Deep filter array of tag/x-tagGroup | ||
let oaTags = JSON.parse(JSON.stringify(node)); // Deep copy of the object | ||
const oaFilteredTags = oaTags.filter(item => !filterProps.some(i => (Object.keys(item).includes(i)))); | ||
this.update(oaFilteredTags); | ||
} | ||
} | ||
@@ -325,0 +326,0 @@ }); |
{ | ||
"name": "openapi-format", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "Format an OpenAPI document by ordering and filtering fields.", | ||
@@ -51,4 +51,4 @@ "keywords": [ | ||
"devDependencies": { | ||
"mocha": "^8.4.0" | ||
"mocha": "^9.1.2" | ||
} | ||
} |
@@ -11,3 +11,4 @@ # openapi-format | ||
  | ||
<a href="https://www.npmjs.com/package/openapi-format" alt="Latest Stable Version"></a> | ||
<a href="https://www.npmjs.com/package/openapi-format" alt="Total Downloads"></a> | ||
@@ -14,0 +15,0 @@ ## Table of content |
49533
515
558