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 #92 from joolfe/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
joolfe authored Mar 14, 2021
2 parents 30b138c + 9abaa1e commit 3eab561
Show file tree
Hide file tree
Showing 29 changed files with 1,860 additions and 2,575 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### [1.6.1](https://github.com/joolfe/postman-to-openapi/compare/1.6.0...1.6.1) (2021-03-14)


### Build System

* update several dependencies ([bff147f](https://github.com/joolfe/postman-to-openapi/commit/bff147f50a42e3aac6776c4fe0e367fa394d958f))

### [1.5.1](https://github.com/joolfe/postman-to-openapi/compare/1.5.0...1.5.1) (2020-10-01)


Expand Down
40 changes: 21 additions & 19 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const { promises: { writeFile, readFile } } = require('fs')
const { safeDump } = require('js-yaml')
const { dump } = require('js-yaml')
const { parseMdTable } = require('./md-utils')
const { version } = require('../package.json')

Expand Down Expand Up @@ -52,7 +52,7 @@ async function postmanToOpenApi (input, output, { info = {}, defaultTag = 'defau
paths
}

const openApiYml = safeDump(openApi, { skipInvalid: true })
const openApiYml = dump(openApi, { skipInvalid: true })
if (output != null) {
await writeFile(output, openApiYml, 'utf8')
}
Expand Down Expand Up @@ -90,12 +90,12 @@ function parseContact (variables, optsContact = {}) {
const { name = nameVar, url = urlVar, email = emailVar } = optsContact
return [name, url, email].some(e => e != null)
? {
contact: {
...(name ? { name } : {}),
...(url ? { url } : {}),
...(email ? { email } : {})
contact: {
...(name ? { name } : {}),
...(url ? { url } : {}),
...(email ? { email } : {})
}
}
}
: {}
}

Expand Down Expand Up @@ -212,19 +212,21 @@ function parseAuth ({ auth }, optAuth) {
/* Parse a postman auth definition */
function parsePostmanAuth (postmanAuth = {}) {
const { type } = postmanAuth
return (type != null) ? {
components: {
securitySchemes: {
[type + 'Auth']: {
type: 'http',
scheme: type
}
return (type != null)
? {
components: {
securitySchemes: {
[type + 'Auth']: {
type: 'http',
scheme: type
}
}
},
security: [{
[type + 'Auth']: []
}]
}
},
security: [{
[type + 'Auth']: []
}]
} : {}
: {}
}

/* Parse a options global auth */
Expand Down
Loading

0 comments on commit 3eab561

Please sign in to comment.