Skip to content

Commit a6c5c4a

Browse files
committed
Update test-infra-scripts repo
1 parent c5b1093 commit a6c5c4a

File tree

2 files changed

+53
-44
lines changed

2 files changed

+53
-44
lines changed

.github/workflows/test-infra-scripts-action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: Track unit-test coverage
22-
uses: postman-eng/test-infra-scripts/.github/actions/coverage-pr-comment-action@main
22+
uses: postmanlabs/test-infra-scripts/.github/actions/coverage-pr-comment-action@main
2323
with:
2424
jobName: 'Unit-Tests'
2525
coverageType: unit
@@ -37,7 +37,7 @@ jobs:
3737
runs-on: ubuntu-latest
3838
steps:
3939
- name: Track integration-test coverage
40-
uses: postman-eng/test-infra-scripts/.github/actions/coverage-pr-comment-action@main
40+
uses: postmanlabs/test-infra-scripts/.github/actions/coverage-pr-comment-action@main
4141
with:
4242
jobName: 'Regression'
4343
coverageType: integration

README.md

Lines changed: 51 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
<img src="https://voyager.postman.com/logo/postman-logo-orange.svg" width="320" alt="The Postman Logo">
12

2-
<img src="https://voyager.postman.com/logo/postman-logo-orange.svg" width="320" alt="The Postman Logo v2">
3-
4-
*Supercharge your API workflow.*
5-
*Modern software is built on APIs. Postman helps you develop APIs faster.*
3+
_Supercharge your API workflow._
4+
_Modern software is built on APIs. Postman helps you develop APIs faster._
65

76
# OpenAPI 3.0, 3.1 and Swagger 2.0 to Postman Collection
87

@@ -15,22 +14,24 @@
1514

1615
1. [Getting Started](#getting-started)
1716
2. [Command Line Interface](#command-line-interface)
18-
1. [Options](#options)
19-
2. [Usage](#usage)
17+
1. [Options](#options)
18+
2. [Usage](#usage)
2019
3. [Using the converter as a NodeJS module](#using-the-converter-as-a-nodejs-module)
21-
1. [Convert Function](#convert)
22-
2. [Options](#options)
23-
3. [ConversionResult](#conversionresult)
24-
4. [Sample usage](#sample-usage)
25-
5. [Validate function](#validate-function)
20+
1. [Convert Function](#convert)
21+
2. [Options](#options)
22+
3. [ConversionResult](#conversionresult)
23+
4. [Sample usage](#sample-usage)
24+
5. [Validate function](#validate-function)
2625
4. [Conversion Schema](#conversion-schema)
2726

2827
---
2928

3029
---
3130

3231
### 🚀 We now also support OpenAPI 3.1 and Swagger 2.0 along with OpenAPI 3.0.
32+
3333
---
34+
3435
---
3536

3637
<h2 id="getting-started">💭 Getting Started</h2>
@@ -47,7 +48,6 @@ If you want to use the converter in the CLI, install it globally with NPM:
4748
$ npm i -g openapi-to-postmanv2
4849
```
4950

50-
5151
<h2 id="command-line-interface">📖 Command Line Interface</h2>
5252

5353
The converter can be used as a CLI tool as well. The following [command line options](#options) are available.
@@ -83,36 +83,38 @@ The converter can be used as a CLI tool as well. The following [command line opt
8383
- `-h`, `--help`
8484
Specifies all the options along with a few usage examples on the terminal
8585

86-
87-
### Usage
86+
### Usage
8887

8988
- Takes a specification (spec.yaml) as an input and writes to a file (collection.json) with pretty printing and using provided options
89+
9090
```terminal
9191
$ openapi2postmanv2 -s spec.yaml -o collection.json -p -O folderStrategy=Tags,includeAuthInfoInExample=false
9292
```
9393

9494
- Takes a specification (spec.yaml) as an input and writes to a file (collection.json) with pretty printing and using provided options via config file
95+
9596
```terminal
9697
$ openapi2postmanv2 -s spec.yaml -o collection.json -p -c ./examples/cli-options-config.json
9798
```
9899

99100
- Takes a specification (spec.yaml) as an input and writes to a file (collection.json) with pretty printing and using provided options (Also avoids any `"<Error: Too many levels of nesting to fake this schema>"` kind of errors present in converted collection)
101+
100102
```terminal
101103
$ openapi2postmanv2 -s spec.yaml -o collection.json -p -O folderStrategy=Tags,requestParametersResolution=Example,optimizeConversion=false,stackLimit=50
102104
```
103105

104106
- Testing the converter
107+
105108
```terminal
106109
$ openapi2postmanv2 --test
107110
```
108111

109-
110112
<h2 id="using-the-converter-as-a-nodejs-module">🛠 Using the converter as a NodeJS module</h2>
111113

112114
In order to use the convert in your node application, you need to import the package using `require`.
113115

114116
```javascript
115-
var Converter = require('openapi-to-postmanv2')
117+
var Converter = require("openapi-to-postmanv2");
116118
```
117119

118120
The converter provides the following functions:
@@ -134,6 +136,7 @@ OR
134136
```
135137

136138
**options:**
139+
137140
```javascript
138141
{
139142
schemaFaker: true,
@@ -144,9 +147,11 @@ OR
144147
All three properties are optional. Check the options section below for possible values for each option.
145148
*/
146149
```
150+
147151
Note: All possible values of options and their usage can be found over here: [OPTIONS.md](/OPTIONS.md)
148152

149153
**callback:**
154+
150155
```javascript
151156
function (err, result) {
152157
/*
@@ -175,21 +180,24 @@ Check out complete list of options and their usage at [OPTIONS.md](/OPTIONS.md)
175180

176181
- `output` - Contains an array of Postman objects, each one with a `type` and `data`. The only type currently supported is `collection`.
177182

178-
179-
180183
### Sample Usage
181-
```javascript
182-
const fs = require('fs'),
183-
Converter = require('openapi-to-postmanv2'),
184-
openapiData = fs.readFileSync('sample-spec.yaml', {encoding: 'UTF8'});
185184

186-
Converter.convert({ type: 'string', data: openapiData },
187-
{}, (err, conversionResult) => {
185+
```javascript
186+
const fs = require("fs"),
187+
Converter = require("openapi-to-postmanv2"),
188+
openapiData = fs.readFileSync("sample-spec.yaml", { encoding: "UTF8" });
189+
190+
Converter.convert(
191+
{ type: "string", data: openapiData },
192+
{},
193+
(err, conversionResult) => {
188194
if (!conversionResult.result) {
189-
console.log('Could not convert', conversionResult.reason);
190-
}
191-
else {
192-
console.log('The collection object is: ', conversionResult.output[0].data);
195+
console.log("Could not convert", conversionResult.reason);
196+
} else {
197+
console.log(
198+
"The collection object is: ",
199+
conversionResult.output[0].data
200+
);
193201
}
194202
}
195203
);
@@ -215,23 +223,24 @@ The validate function is synchronous and returns a status object which conforms
215223
```
216224

217225
##### Validation object explanation
226+
218227
- `result` - true if the data looks like OpenAPI and can be passed to the convert function
219228

220229
- `reason` - Provides a reason for an unsuccessful validation of the specification
221230

222231
<h2 id="conversion-schema">🧭 Conversion Schema</h2>
223232

224-
| *postman* | *openapi* | *related options* |
225-
| --- | --- | :---: |
226-
| collectionName | info.title | - |
227-
| description | info.description + info.contact | - |
228-
| collectionVariables| server.variables + pathVariables | - |
229-
| folderName | paths.path / tags.name | folderStrategy |
230-
| requestName | operationItem(method).summary / operationItem(method).operationId / url | requestNameSource |
231-
| request.method | path.method | - |
232-
| request.headers | parameter (`in = header`) | - | [link](#Header/Path-param-conversion-example) |
233-
| request.body | operationItem(method).requestBody | requestParametersResolution, exampleParametersResolution |
234-
| request.url.raw | server.url (path level server >> openapi server) + path | - |
235-
| request.url.variables | parameter (`in = path`) | - |
236-
| request.url.params | parameter (`in = query`) | - |
237-
| api_key in (query or header) | components.securitySchemes.api_key | includeAuthInfoInExample |
233+
| _postman_ | _openapi_ | _related options_ |
234+
| ---------------------------- | ----------------------------------------------------------------------- | :------------------------------------------------------: | --------------------------------------------- |
235+
| collectionName | info.title | - |
236+
| description | info.description + info.contact | - |
237+
| collectionVariables | server.variables + pathVariables | - |
238+
| folderName | paths.path / tags.name | folderStrategy |
239+
| requestName | operationItem(method).summary / operationItem(method).operationId / url | requestNameSource |
240+
| request.method | path.method | - |
241+
| request.headers | parameter (`in = header`) | - | [link](#Header/Path-param-conversion-example) |
242+
| request.body | operationItem(method).requestBody | requestParametersResolution, exampleParametersResolution |
243+
| request.url.raw | server.url (path level server >> openapi server) + path | - |
244+
| request.url.variables | parameter (`in = path`) | - |
245+
| request.url.params | parameter (`in = query`) | - |
246+
| api_key in (query or header) | components.securitySchemes.api_key | includeAuthInfoInExample |

0 commit comments

Comments
 (0)