You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 27, 2024. It is now read-only.
The third parameter used in the library method is an `options` object containing the optional parameters for the transformation, the allowed parameters are:
76
+
77
+
### info (Object)
78
+
79
+
The basic information of the API is obtained from Postman collection as described in section [default info](#basic-api-info), but you can customize this parameters using the `info` options that can contain the next parameters:
|`version`| String. The version of the OpenAPI document. |
85
+
|`description`| String. A short description of the API. |
86
+
|`termsOfService`| String. A URL to the Terms of Service for the API. MUST be in the format of a URL. |
87
+
88
+
Basically this are the required and relevant parameters defined in OpenAPI spec [info object](https://swagger.io/specification/#info-object), an example of the option will be:
89
+
90
+
```js
91
+
{
92
+
info: {
93
+
title:'Options title',
94
+
version:'6.0.7-beta',
95
+
description:'Description from options',
96
+
termsOfService:'http://tos.myweb.com'
97
+
}
98
+
}
99
+
```
100
+
101
+
### defaultTag (String)
102
+
103
+
By default the [tag value](https://swagger.io/specification/#tag-object) "default" is added to all the operations during transformation, unless this operations are inside a folder as described in section [folder as tags](#folders-as-tags).
104
+
105
+
If you want to customize the default tag use the options `defaultTag` to indicate the desired value.
The global authorization info can be parse from the Postman collection as described in [Global authorization](#global-authorization) section, but you can customize this info using the `auth` option, this param is a Object that follow the structure of OpenAPI [Security Scheme](https://swagger.io/specification/#security-scheme-object), in this moment only type `http` is supported and schemes `basic` and `bearer`, as an example of this option:
114
+
115
+
```js
116
+
{
117
+
myCustomAuth: {
118
+
type:'http',
119
+
scheme:'bearer',
120
+
bearerFormat:'A resource owner JWT',
121
+
description:'My awesome authentication using bearer'
122
+
},
123
+
myCustomAuth2: {
124
+
type:'http',
125
+
scheme:'basic',
126
+
description:'My awesome authentication using user and password'
127
+
}
128
+
}
129
+
```
130
+
77
131
</div></div>
78
132
<divclass="tilted-section"><divmarkdown="1">
79
133
80
134
# Features
81
135
136
+
## Basic API info
137
+
138
+
For fill the OpenAPI [info object](https://swagger.io/specification/#info-object) this library use the information defined in Postman [collection](https://learning.postman.com/docs/sending-requests/intro-to-collections/#creating-collections) level as "name" and "description".
139
+
140
+
Postman don't have any field at collection level that feat with OpenAPI "version" field (is a required field in OpenAPI specification), so this library look for a variable with name `version` in Postman [collection variables](https://learning.postman.com/docs/sending-requests/variables/#defining-collection-variables) or if variable is not defined then will use the default value `1.0.0`.
141
+
142
+
You can customize all this information with the [Info option](#info-(object)).
143
+
144
+
Have a look to the [SimplePost collection](https://github.com/joolfe/postman-to-openapi/blob/master/test/resources/input/SimplePost.json) file for an example of how to use this feature.
145
+
146
+
## Folders as tags
147
+
148
+
In postman you can add [folders](https://learning.postman.com/docs/sending-requests/intro-to-collections/) inside your collection to group requests and keep the collection clean, in OpenAPI there are no folders but exist the concept of [tags](https://swagger.io/specification/#tag-object) that has the same approximate meaning, this library automatically detect folders and use the name of the folder as tag name in the transformation. Right now is not possible to have more than one tag value for each operation.
149
+
150
+
Have a look to the [FolderCollection](https://github.com/joolfe/postman-to-openapi/blob/master/test/resources/input/FolderCollection.json) file for an example of how to use this feature.
151
+
152
+
## Global authorization
153
+
154
+
The OpenAPI root [security]https://swagger.io/specification/#openapi-object) definition is filled using the authorization method defined at Postman Collection [authorization config](https://learning.postman.com/docs/sending-requests/authorization/#inheriting-auth).
155
+
156
+
Only types 'Basic Auth' and 'Bearer Token' are supported now and not operation individual definition is supported.
157
+
158
+
You can customize the global authorization definition using the [Auth option](#auth-(object)).
159
+
160
+
Have a look to the collections [AuthBasic](https://github.com/joolfe/postman-to-openapi/blob/master/test/resources/input/AuthBasic.json) and [AuthBearer](https://github.com/joolfe/postman-to-openapi/blob/master/test/resources/input/AuthBearer.json) for examples of how to use this feature.
0 commit comments