|
18 | 18 |
|
19 | 19 | * Postman Collection v2.1 and v2.0. |
20 | 20 | * OpenApi 3.0 |
21 | | -* 🆕 Cli available |
| 21 | +* Cli available |
| 22 | +* 🆕 Postman variables automatically replaced. |
22 | 23 | * Basic info API from Postman info or customizable. |
23 | 24 | * Basic method conversion (GET, POST, PUT...). |
24 | 25 | * Support Postman folders as tags. |
|
31 | 32 | * Provide meta-information as a markdown table. |
32 | 33 | * Path depth configuration. |
33 | 34 | * API Response parse from postman examples and from test code (status code). |
34 | | -* [x-logo](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md#x-logo) extension support |
| 35 | +* [x-logo](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md#x-logo) extension support. |
35 | 36 |
|
36 | 37 | See [Features](#features) section for more details about how to use each of this features. |
37 | 38 |
|
@@ -129,6 +130,8 @@ The third parameter used in the library method is an `options` object containing |
129 | 130 | | [externalDocs](#externaldocs-object) | Info about the API external documentation. | |
130 | 131 | | [folders](#folders-object) | Config object for folders and nested folders in postman collection. | |
131 | 132 | | [responseHeaders](#responseheaders-boolean) | Indicate if should parse the response headers from the collection examples. | |
| 133 | +| [replaceVars](#replacevars-boolean) | Boolean value to indicate if postman variables should be replaced.| |
| 134 | +| [additionalVars](#additionalvars-object) | Object to provide additional values for variables replacement.| |
132 | 135 |
|
133 | 136 | ### info (Object) |
134 | 137 |
|
@@ -316,6 +319,33 @@ This flag indicates if the headers that are saved as part of the postman collect |
316 | 319 |
|
317 | 320 | The default value is `true`, so headers are by default added to the response definition. |
318 | 321 |
|
| 322 | +### replaceVars (Boolean) |
| 323 | + |
| 324 | +This flag indicates if the [postman variables](https://learning.postman.com/docs/sending-requests/variables/) referenced in the postman collection should be replaced before generate the OpenAPI specs. |
| 325 | + |
| 326 | +If set to `true` all variable references contained in the postman collection as "{{variable}}" will be replaced by his value defined at [postman collection level](https://learning.postman.com/docs/sending-requests/variables/#defining-collection-variables) or values provided the [additionalVars Object](#additionalvars-object). |
| 327 | + |
| 328 | +Be aware that path variables defined as postman variables "{{variable}}" as for example a path like `https://api.io/users/{{user_id}}` will be also replaced if there exist a variable definition at postman collection or in the [additionalVars Object](#additionalvars-object). |
| 329 | + |
| 330 | +The default value for this flag is `false` as variable replacement has a performance cost. |
| 331 | + |
| 332 | +### additionalVars (Object) |
| 333 | + |
| 334 | +In postman, variables can be defined at different [scopes level](https://learning.postman.com/docs/sending-requests/variables/#variable-scopes) but only the ones defined at [postman collection level](https://learning.postman.com/docs/sending-requests/variables/#defining-collection-variables) will be saved inside collection file, to provide additional variable values, what we can call Global or Environment variables, there exist the `additionalVars` parameter. |
| 335 | + |
| 336 | +This parameter is a json Object that contain as key the variable name and as value the variable value, as for example: |
| 337 | + |
| 338 | +```js |
| 339 | +{ |
| 340 | + additionalVars: { |
| 341 | + service : 'myService', |
| 342 | + company : 'myCompany' |
| 343 | + } |
| 344 | +} |
| 345 | +``` |
| 346 | + |
| 347 | +Take into account that variable values provided in the `additionalVars` Object supersede those defined at Postman collection level. |
| 348 | + |
319 | 349 | # Features |
320 | 350 |
|
321 | 351 | ## Basic conversion |
@@ -352,7 +382,7 @@ This library automatically transform query and headers parameters from Postman o |
352 | 382 |
|
353 | 383 | The default schema used for parameters is `string` but the library try to infer the type of the parameters based on the value using regular expressions, the detected types are `integer`, `number`, `boolean` and `string`, if you find any problem in the inference process please open an issue. |
354 | 384 |
|
355 | | -Path parameters are also automatically detected, this library look for [Postman variables](https://learning.postman.com/docs/sending-requests/variables/) in the url as "{{variable}}" and transform to a single curly brace expression as `{variable}` as supported by OpenAPI, also create the parameter definition using the variable name. To provide additional information about a path parameter you can [Pass Meta-information as markdown](#pass-meta-information-as-markdown). |
| 385 | +Path parameters are also automatically detected, this library look for [Postman variables](https://learning.postman.com/docs/sending-requests/variables/) in the url as "{{variable}}" and transform to a single curly brace expression as `{variable}` as supported by OpenAPI, also create the parameter definition using the variable name. To provide additional information about a path parameter you can [Pass Meta-information as markdown](#pass-meta-information-as-markdown). Be aware that if you use the `replaceVar` option the path parameter using Postman variables can be affected. See [replaceVars option](#replacevars-boolean) |
356 | 386 |
|
357 | 387 | For headers and query fields you can indicate that this parameter is mandatory/required adding into the description the literal `[required]`. The library use a case insensitive regexp so all variations are supported (`[REQUIRED]`, `[Required]`...) and never mind the location inside the description (at the beginning, at the end...). |
358 | 388 |
|
|
0 commit comments