Skip to content
This repository has been archived by the owner on Dec 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #151 from joolfe/develop
Browse files Browse the repository at this point in the history
Deps update and ts update
  • Loading branch information
joolfe authored Sep 18, 2021
2 parents d0eabd1 + f990c8b commit b8d6931
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 39 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
### [1.17.3](https://github.com/joolfe/postman-to-openapi/compare/1.17.2...1.17.3) (2021-09-18)


### Bug Fixes

* update typescript definition with last added options ([4f83072](https://github.com/joolfe/postman-to-openapi/commit/4f8307236272499746d44483602e4a863de07695))


### Build System

* update dependencies to vastest versions ([513ed85](https://github.com/joolfe/postman-to-openapi/commit/513ed85b7677246726ce412da676971b2f65c13a))

### [1.17.2](https://github.com/joolfe/postman-to-openapi/compare/1.17.1...1.17.2) (2021-09-04)


Expand Down
4 changes: 3 additions & 1 deletion lib/md-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ function parseMdTable (md) {
const parsed = marked.lexer(md)
const table = parsed.find(el => el.type === 'table')
if (table == null) return {}
const { header, cells } = table
const { header: rawHeader, rows } = table
const cells = rows.map(row => row.map(e => e.text))
const header = rawHeader.map(e => e.text)
if (!header.includes('object') || !header.includes('name')) return {}
const headers = header.map(h => supHeaders.includes(h) ? h : false)
const tableObj = cells.reduce((accTable, cell, i) => {
Expand Down
67 changes: 35 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postman-to-openapi",
"version": "1.17.2",
"version": "1.17.3",
"description": "Convert postman collection to OpenAPI spec",
"main": "lib/index.js",
"types": "types/index.d.ts",
Expand Down Expand Up @@ -53,10 +53,10 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"execa": "^5.1.1",
"husky": "^6.0.0",
"husky": "^7.0.2",
"mocha": "^9.0.3",
"nyc": "^15.1.0",
"typescript": "^4.3.2"
"typescript": "^4.4.3"
},
"commitlint": {
"extends": [
Expand Down Expand Up @@ -86,9 +86,9 @@
"check-coverage": true
},
"dependencies": {
"commander": "^7.2.0",
"commander": "^8.2.0",
"js-yaml": "^4.1.0",
"marked": "^2.0.7",
"marked": "^3.0.4",
"mustache": "^4.2.0"
},
"husky": {
Expand Down
7 changes: 6 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ export interface Options {
auth?: AuthOptions,
servers?: Array<ServerObject>,
externalDocs?: ExternalDocsObject,
folders?: FoldersOption
folders?: FoldersOption,
// Default value true
responseHeaders?: boolean,
// Default value false
replaceVars?: boolean,
additionalVars?: { [key: string]: string }
}

export default function postmanToOpenApi (input: string, output?: string, options?: Options) : string
21 changes: 21 additions & 0 deletions types/typescript-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,25 @@ const options:Options = {
folders
};

const options2:Options = {
info,
defaultTag: 'my Tag',
pathDepth: 0,
auth: {
'basicAuth': basicAuth,
'bearerAuth': bearerAuth
},
servers: [serverDev, serverPro],
externalDocs,
folders,
responseHeaders: false,
replaceVars: false,
additionalVars: {
'key': 'value',
'key2': 'value2'
}
};

(async () => {

const openAPI1 = postmanToOpenApi('./path/to/postman_collection.json')
Expand All @@ -80,4 +99,6 @@ const options:Options = {

const openAPI3 = postmanToOpenApi('./path/to/postman_collection.json', './path/to/result/openApi.yml', options)

const openAPI4 = postmanToOpenApi('./path/to/postman_collection.json', './path/to/result/openApi.yml', options2)

})();

0 comments on commit b8d6931

Please sign in to comment.