Skip to content
This repository was archived by the owner on Oct 10, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node-version: ['10.18.0', '*']
node-version: ['12.20.0', '*']
exclude:
- os: macOS-latest
node-version: '10.18.0'
node-version: '12.20.0'
- os: windows-latest
node-version: '10.18.0'
node-version: '12.20.0'
fail-fast: false
steps:
- name: Git checkout
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"webpack-cli": "^4.5.0"
},
"engines": {
"node": ">=10.18.0"
"node": "^12.20.0 || ^14.14.0 || >=16.0.0"
},
"ava": {
"files": [
Expand Down
18 changes: 7 additions & 11 deletions src/operations.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@ const omit = require('omit.js').default

// Retrieve all OpenAPI operations
const getOperations = function () {
// TODO: switch to Array.flat() once we drop support for Node.js < 11.0.0
// eslint-disable-next-line unicorn/prefer-spread
return [].concat(
...Object.entries(paths).map(([path, pathItem]) => {
const operations = omit(pathItem, ['parameters'])
return Object.entries(operations).map(([method, operation]) => {
const parameters = getParameters(pathItem.parameters, operation.parameters)
return { ...operation, verb: method, path, parameters }
})
}),
)
return Object.entries(paths).flatMap(([path, pathItem]) => {
const operations = omit(pathItem, ['parameters'])
return Object.entries(operations).map(([method, operation]) => {
const parameters = getParameters(pathItem.parameters, operation.parameters)
return { ...operation, verb: method, path, parameters }
})
})
}

const getParameters = function (pathParameters = [], operationParameters = []) {
Expand Down