diff --git a/lib/yaml-scraper.js b/lib/yaml-scraper.js index f07ab2b..02b6fb4 100644 --- a/lib/yaml-scraper.js +++ b/lib/yaml-scraper.js @@ -53,10 +53,6 @@ const deleteParentRecursion = (obj, target) => { delete obj[key]; } else if (typeof obj[key] === 'object') { deleteParentRecursion(obj[key], target); - if (Object.keys(obj[key]).length === 0) { - // eslint-disable-next-line no-param-reassign - delete obj[key]; - } } }); }; diff --git a/sample/sample-delete-deprecated-parent.yaml b/sample/sample-delete-deprecated-parent.yaml index c630df2..285d463 100644 --- a/sample/sample-delete-deprecated-parent.yaml +++ b/sample/sample-delete-deprecated-parent.yaml @@ -3,9 +3,12 @@ info: description: sample title: sample paths: + '/rooms/{room-id}': {} '/rooms/{room-id}/doors': post: responses: '200': schema: type: object + security: + - api_key: [] diff --git a/sample/sample-delete-example.yaml b/sample/sample-delete-example.yaml index cbf357e..1462fc1 100644 --- a/sample/sample-delete-example.yaml +++ b/sample/sample-delete-example.yaml @@ -21,6 +21,8 @@ paths: type: integer comment: type: string + security: + - api_key: [] '/rooms/{room-id}/doors': get: deprecated: true @@ -28,8 +30,12 @@ paths: '200': schema: type: array + security: + - api_key: [] post: responses: '200': schema: type: object + security: + - api_key: [] diff --git a/sample/sample-empty-description.yaml b/sample/sample-empty-description.yaml index f71b854..cb9254c 100644 --- a/sample/sample-empty-description.yaml +++ b/sample/sample-empty-description.yaml @@ -23,6 +23,8 @@ paths: comment: type: string example: 404 + security: + - api_key: [] '/rooms/{room-id}/doors': get: deprecated: true @@ -30,8 +32,12 @@ paths: '200': schema: type: array + security: + - api_key: [] post: responses: '200': schema: type: object + security: + - api_key: [] diff --git a/sample/sample-full.yaml b/sample/sample-full.yaml index aa0d36a..79da30f 100644 --- a/sample/sample-full.yaml +++ b/sample/sample-full.yaml @@ -23,6 +23,8 @@ paths: comment: type: string example: 404 + security: + - api_key: [] '/rooms/{room-id}/doors': get: deprecated: true @@ -30,8 +32,12 @@ paths: '200': schema: type: array + security: + - api_key: [] post: responses: '200': schema: type: object + security: + - api_key: []