Skip to content

Commit

Permalink
Merge pull request #2 from segurvita/feature/#1-fix-delete-parent
Browse files Browse the repository at this point in the history
Feature/#1 fix delete parent
  • Loading branch information
segurvita authored Jul 12, 2019
2 parents 4eea6f7 + 6633b5a commit a3430e9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
4 changes: 0 additions & 4 deletions lib/yaml-scraper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}
});
};
Expand Down
3 changes: 3 additions & 0 deletions sample/sample-delete-deprecated-parent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: []
6 changes: 6 additions & 0 deletions sample/sample-delete-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,21 @@ paths:
type: integer
comment:
type: string
security:
- api_key: []
'/rooms/{room-id}/doors':
get:
deprecated: true
responses:
'200':
schema:
type: array
security:
- api_key: []
post:
responses:
'200':
schema:
type: object
security:
- api_key: []
6 changes: 6 additions & 0 deletions sample/sample-empty-description.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,21 @@ paths:
comment:
type: string
example: 404
security:
- api_key: []
'/rooms/{room-id}/doors':
get:
deprecated: true
responses:
'200':
schema:
type: array
security:
- api_key: []
post:
responses:
'200':
schema:
type: object
security:
- api_key: []
6 changes: 6 additions & 0 deletions sample/sample-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,21 @@ paths:
comment:
type: string
example: 404
security:
- api_key: []
'/rooms/{room-id}/doors':
get:
deprecated: true
responses:
'200':
schema:
type: array
security:
- api_key: []
post:
responses:
'200':
schema:
type: object
security:
- api_key: []

0 comments on commit a3430e9

Please sign in to comment.