Skip to content

Commit

Permalink
Merge pull request #221 from joolfe/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
joolfe authored Sep 17, 2022
2 parents 72b6bd1 + 76867b9 commit 64a7dc7
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### [2.6.2](https://github.com/joolfe/postman-to-openapi/compare/2.6.1...2.6.2) (2022-09-17)


### Bug Fixes

* support collections without the headers fields in request close [#217](https://github.com/joolfe/postman-to-openapi/issues/217) ([fa93c35](https://github.com/joolfe/postman-to-openapi/commit/fa93c35426b7607072d945ca9143794288b6c4bd))

### [2.6.1](https://github.com/joolfe/postman-to-openapi/compare/2.6.0...2.6.1) (2022-09-17)


Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function postmanToOpenApi (input, output, {
// If there are an empty folder at the end of the colection elements could be `undefined`
if (element != null) {
const {
request: { url, method, body, description: rawDesc, header, auth },
request: { url, method, body, description: rawDesc, header = [], auth },
name: summary, tag = defaultTag, event: events, response
} = element
const { path, query, protocol, host, port, valid, pathVars } = scrapeURL(url)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postman-to-openapi",
"version": "2.6.1",
"version": "2.6.2",
"description": "Convert postman collection to OpenAPI spec",
"main": "lib/index.js",
"types": "types/index.d.ts",
Expand Down
28 changes: 28 additions & 0 deletions test/resources/input/NullHeaders.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,34 @@
"body": "{\n \"erreur\": null,\n \"codeErreur\": 0,\n \"contenu\": {\n \"token\": \"ct54q7uoidffg2z661afigu98ix476s8\"\n }\n}"
}
]
},
{
"name": "Missing headers field",
"request": {
"method": "POST",
"body": {
"mode": "raw",
"raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://api.io/userHeader",
"protocol": "https",
"host": [
"api",
"io"
],
"path": [
"userHeader"
]
},
"description": "Create a new user into your amazing API"
},
"response": []
}
],
"event": [
Expand Down
22 changes: 22 additions & 0 deletions test/resources/output/NullHeader.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ info:
version: 1.0.0
servers:
- url: http://{{url}}
- url: https://api.io
tags:
- name: Authentification
paths:
Expand Down Expand Up @@ -47,3 +48,24 @@ paths:
codeErreur: 0
contenu:
token: ct54q7uoidffg2z661afigu98ix476s8
/userHeader:
post:
tags:
- Authentification
summary: Missing headers field
description: Create a new user into your amazing API
requestBody:
content:
application/json:
schema:
type: object
example:
example: field
other:
data1: 'yes'
data2: 'no'
responses:
'200':
description: Successful response
content:
application/json: {}

0 comments on commit 64a7dc7

Please sign in to comment.