Skip to content
This repository was archived by the owner on Dec 27, 2024. It is now read-only.

Commit 9cfd142

Browse files
committed
docs: update documentation with new replacement feature
1 parent 75f8df1 commit 9cfd142

1 file changed

Lines changed: 33 additions & 3 deletions

File tree

docs/index.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818

1919
* Postman Collection v2.1 and v2.0.
2020
* OpenApi 3.0
21-
* 🆕 Cli available
21+
* Cli available
22+
* 🆕 Postman variables automatically replaced.
2223
* Basic info API from Postman info or customizable.
2324
* Basic method conversion (GET, POST, PUT...).
2425
* Support Postman folders as tags.
@@ -31,7 +32,7 @@
3132
* Provide meta-information as a markdown table.
3233
* Path depth configuration.
3334
* 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.
3536

3637
See [Features](#features) section for more details about how to use each of this features.
3738

@@ -129,6 +130,8 @@ The third parameter used in the library method is an `options` object containing
129130
| [externalDocs](#externaldocs-object) | Info about the API external documentation. |
130131
| [folders](#folders-object) | Config object for folders and nested folders in postman collection. |
131132
| [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.|
132135

133136
### info (Object)
134137

@@ -316,6 +319,33 @@ This flag indicates if the headers that are saved as part of the postman collect
316319

317320
The default value is `true`, so headers are by default added to the response definition.
318321

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+
319349
# Features
320350

321351
## Basic conversion
@@ -352,7 +382,7 @@ This library automatically transform query and headers parameters from Postman o
352382

353383
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.
354384

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)
356386

357387
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...).
358388

0 commit comments

Comments
 (0)