Skip to content

Commit c92f37f

Browse files
committed
Merge branch 'develop' into feat/deprecatedOption
2 parents 935acd7 + 941823d commit c92f37f

18 files changed

+367
-76
lines changed

.github/workflows/integration.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
node-version: '14.x'
1414
- run: npm install
1515
- run: npm run test-lint
16+
- run: npm run test-system
1617
- run: npm run test-unit
1718

1819
Regression:

.travis.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

OPTIONS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ requestParametersResolution|enum|Example, Schema|Schema|Select whether to genera
88
exampleParametersResolution|enum|Example, Schema|Example|Select whether to generate the response parameters based on the [schema](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#schemaObject) or the [example](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#exampleObject) in the schema.|CONVERSION
99
folderStrategy|enum|Paths, Tags|Paths|Select whether to create folders according to the spec’s paths or tags.|CONVERSION
1010
schemaFaker|boolean|-|true|Whether or not schemas should be faked.|CONVERSION
11-
stackLimit|integer|-|10|Number of nesting limit till which schema resolution will happen. Increasing this limit may result in more time to convert collection depending on complexity of specification. (To make sure this option works correctly "optimizeConversion" option needs to be disabled)|CONVERSION
11+
stackLimit|integer|-|8|Number of nesting limit till which schema resolution will happen. Increasing this limit may result in more time to convert collection depending on complexity of specification. (To make sure this option works correctly "optimizeConversion" option needs to be disabled)|CONVERSION
1212
includeAuthInfoInExample|boolean|-|true|Select whether to include authentication parameters in the example request|CONVERSION
1313
shortValidationErrors|boolean|-|false|Whether detailed error messages are required for request <> schema validation operations.|VALIDATION
1414
validationPropertiesToIgnore|array|-|[]|Specific properties (parts of a request/response pair) to ignore during validation. Must be sent as an array of strings. Valid inputs in the array: PATHVARIABLE, QUERYPARAM, HEADER, BODY, RESPONSE_HEADER, RESPONSE_BODY|VALIDATION

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11

2-
![postman icon](https://raw.githubusercontent.com/postmanlabs/postmanlabs.github.io/develop/global-artefacts/postman-logo%2Btext-320x132.png)
2+
<img src="https://voyager.postman.com/logo/postman-logo-orange.svg" width="320" alt="The Postman Logo">
33

4-
*Supercharge your API workflow.*
4+
*Supercharge your API workflow.*
55
*Modern software is built on APIs. Postman helps you develop APIs faster.*
66

77
# OpenAPI 3.0 to Postman Collection v2.1.0 Converter
88

9-
[![Build Status](https://travis-ci.org/postmanlabs/openapi-to-postman.svg?branch=master)](https://travis-ci.org/postmanlabs/openapi-to-postman)
10-
<a href="https://www.npmjs.com/package/openapi-to-postmanv2" alt="Latest Stable Version">![npm](https://img.shields.io/npm/v/openapi-to-postmanv2.svg)</a>
9+
![Build Status](https://github.com/postmanlabs/openapi-to-postman/actions/workflows/integration.yml/badge.svg)
10+
11+
<a href="https://www.npmjs.com/package/openapi-to-postmanv2" alt="Latest Stable Version">![npm](https://img.shields.io/npm/v/openapi-to-postmanv2.svg)</a>
1112
<a href="https://www.npmjs.com/package/openapi-to-postmanv2" alt="Total Downloads">![npm](https://img.shields.io/npm/dw/openapi-to-postmanv2.svg)</a>
1213

13-
#### Contents
14+
#### Contents
1415

1516
1. [Getting Started](#getting-started)
1617
2. [Using the converter as a NodeJS module](#using-the-converter-as-a-nodejs-module)
@@ -101,7 +102,7 @@ Check out complete list of options and their usage at [OPTIONS.md](/OPTIONS.md)
101102

102103
### ConversionResult
103104

104-
- `result` - Flag responsible for providing a status whether the conversion was successful or not
105+
- `result` - Flag responsible for providing a status whether the conversion was successful or not
105106

106107
- `reason` - Provides the reason for an unsuccessful conversion, defined only if result: false
107108

@@ -160,28 +161,28 @@ The converter can be used as a CLI tool as well. The following [command line opt
160161
`openapi2postmanv2 [options]`
161162

162163
### Options
163-
- `-v`, `--version`
164+
- `-v`, `--version`
164165
Specifies the version of the converter
165166

166-
- `-s <source>`, `--spec <source>`
167+
- `-s <source>`, `--spec <source>`
167168
Used to specify the OpenAPI specification (file path) which is to be converted
168169

169-
- `-o <destination>`, `--output <destination>`
170+
- `-o <destination>`, `--output <destination>`
170171
Used to specify the destination file in which the collection is to be written
171172

172-
- `-t`, `--test`
173+
- `-t`, `--test`
173174
Used to test the collection with an in-built sample specification
174175

175-
- `-p`, `--pretty`
176+
- `-p`, `--pretty`
176177
Used to pretty print the collection object while writing to a file
177178

178179
- `-O`, `--options`
179180
Used to supply options to the converter, for complete options details see [here](/OPTIONS.md)
180181

181-
- `-c`, `--options-config`
182+
- `-c`, `--options-config`
182183
Used to supply options to the converter through config file, for complete options details see [here](/OPTIONS.md)
183184

184-
- `-h`, `--help`
185+
- `-h`, `--help`
185186
Specifies all the options along with a few usage examples on the terminal
186187

187188

lib/deref.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ module.exports = {
149149
*/
150150

151151
resolveRefs: function (schema, parameterSourceOption, components, schemaResolutionCache,
152-
resolveFor = 'CONVERSION', resolveTo = 'schema', stack = 0, seenRef = {}, stackLimit = 10, isAllOf = false) {
152+
resolveFor = 'CONVERSION', resolveTo = 'schema', stack = 0, seenRef = {}, stackLimit = 8, isAllOf = false) {
153153
var resolvedSchema, prop, splitRef,
154154
ERR_TOO_MANY_LEVELS = '<Error: Too many levels of nesting to fake this schema>';
155155
let concreteUtils = components && components.hasOwnProperty('concreteUtils') ?

lib/options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ module.exports = {
155155
name: 'Schema resolution nesting limit',
156156
id: 'stackLimit',
157157
type: 'integer',
158-
default: 10,
158+
default: 8,
159159
description: 'Number of nesting limit till which schema resolution will happen. Increasing this limit may' +
160160
' result in more time to convert collection depending on complexity of specification. (To make sure this' +
161161
' option works correctly "optimizeConversion" option needs to be disabled)',

lib/schemaUtils.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ module.exports = {
309309

310310
var computedOptions = _.clone(options);
311311

312-
computedOptions.stackLimit = 10;
312+
computedOptions.stackLimit = 8;
313313
// This is the score that is given to each spec on the basis of the
314314
// number of references present in spec and the number of requests that will be generated.
315315
// This ranges from 0-10.
@@ -1126,33 +1126,33 @@ module.exports = {
11261126
helper = {
11271127
type: 'basic',
11281128
basic: [
1129-
{ key: 'username', value: '<Basic Auth Username>' },
1130-
{ key: 'password', value: '<Basic Auth Password>' }
1129+
{ key: 'username', value: '{{basicAuthUsername}}' },
1130+
{ key: 'password', value: '{{basicAuthPassword}}' }
11311131
]
11321132
};
11331133
}
11341134
else if (_.toLower(securityDef.scheme) === 'bearer') {
11351135
helper = {
11361136
type: 'bearer',
1137-
bearer: [{ key: 'token', value: '<Bearer Token>' }]
1137+
bearer: [{ key: 'token', value: '{{bearerToken}}' }]
11381138
};
11391139
}
11401140
else if (_.toLower(securityDef.scheme) === 'digest') {
11411141
helper = {
11421142
type: 'digest',
11431143
digest: [
1144-
{ key: 'username', value: '<Digest Auth Username>' },
1145-
{ key: 'password', value: '<Digest Auth Password>' },
1146-
{ key: 'realm', value: '<realm>' }
1144+
{ key: 'username', value: '{{digestAuthUsername}}' },
1145+
{ key: 'password', value: '{{digestAuthPassword}}' },
1146+
{ key: 'realm', value: '{{realm}}' }
11471147
]
11481148
};
11491149
}
11501150
else if (_.toLower(securityDef.scheme) === 'oauth' || _.toLower(securityDef.scheme) === 'oauth1') {
11511151
helper = {
11521152
type: 'oauth1',
11531153
oauth1: [
1154-
{ key: 'consumerSecret', value: '<OAuth 1.0 Consumer Key>' },
1155-
{ key: 'consumerKey', value: '<OAuth 1.0 Consumer Secret>' },
1154+
{ key: 'consumerSecret', value: '{{consumerSecret}}' },
1155+
{ key: 'consumerKey', value: '{{consumerKey}}' },
11561156
{ key: 'addParamsToHeader', value: true }
11571157
]
11581158
};
@@ -1205,7 +1205,7 @@ module.exports = {
12051205
if (!_.isEmpty(flowObj.refreshUrl)) {
12061206
helper.oauth2.push({
12071207
key: 'redirect_uri',
1208-
value: _.isString(flowObj.refreshUrl) ? flowObj.refreshUrl : '{{OAuth2_CallbackURL}}'
1208+
value: _.isString(flowObj.refreshUrl) ? flowObj.refreshUrl : '{{oAuth2CallbackURL}}'
12091209
});
12101210
}
12111211

@@ -1214,7 +1214,7 @@ module.exports = {
12141214
if (!_.isEmpty(flowObj.tokenUrl)) {
12151215
helper.oauth2.push({
12161216
key: 'accessTokenUrl',
1217-
value: _.isString(flowObj.tokenUrl) ? flowObj.tokenUrl : '{{OAuth2_AccessTokenURL}}'
1217+
value: _.isString(flowObj.tokenUrl) ? flowObj.tokenUrl : '{{oAuth2AccessTokenURL}}'
12181218
});
12191219
}
12201220
}
@@ -1224,7 +1224,7 @@ module.exports = {
12241224
if (!_.isEmpty(flowObj.authorizationUrl)) {
12251225
helper.oauth2.push({
12261226
key: 'authUrl',
1227-
value: _.isString(flowObj.authorizationUrl) ? flowObj.authorizationUrl : '{{OAuth2_AuthURL}}'
1227+
value: _.isString(flowObj.authorizationUrl) ? flowObj.authorizationUrl : '{{oAuth2AuthURL}}'
12281228
});
12291229
}
12301230
}
@@ -1241,9 +1241,9 @@ module.exports = {
12411241
apikey: [
12421242
{
12431243
key: 'key',
1244-
value: _.isString(securityDef.name) ? securityDef.name : '<API Key Name>'
1244+
value: _.isString(securityDef.name) ? securityDef.name : '{{apiKeyName}}'
12451245
},
1246-
{ key: 'value', value: '<API Key>' },
1246+
{ key: 'value', value: '{{apiKey}}' },
12471247
{
12481248
key: 'in',
12491249
value: _.includes(['query', 'header'], securityDef.in) ? securityDef.in : 'header'

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
"lodash": "4.17.21",
126126
"oas-resolver-browser": "2.5.6",
127127
"path-browserify": "1.0.1",
128-
"postman-collection": "4.1.4",
128+
"postman-collection": "4.1.5",
129129
"swagger2openapi": "7.0.8",
130130
"traverse": "0.6.6",
131131
"yaml": "1.10.2"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
openapi: "3.0.0"
2+
info:
3+
version: 1.0.0
4+
title: Swagger Petstore
5+
license:
6+
name: MIT
7+
servers:
8+
- url: https://postman-echo.com/get
9+
security:
10+
- bear: []
11+
paths:
12+
/pets/{petId}:
13+
get:
14+
summary: Info for a specific pet
15+
operationId: showPetById
16+
tags:
17+
- pets
18+
parameters:
19+
- name: petId
20+
in: path
21+
required: true
22+
description: The id of the pet to retrieve
23+
schema:
24+
type: string
25+
responses:
26+
default:
27+
description: unexpected error
28+
content:
29+
application/json:
30+
schema:
31+
$ref: "#/components/schemas/Error"
32+
components:
33+
schemas:
34+
Error:
35+
type: object
36+
required:
37+
- code
38+
- message
39+
properties:
40+
code:
41+
type: integer
42+
format: int32
43+
message:
44+
type: string
45+
securitySchemes:
46+
bear:
47+
type: apiKey

0 commit comments

Comments
 (0)