├── .editorconfig ├── .eslintrc.json ├── .github └── workflows │ ├── codeql-analysis.yml │ └── node.js.yml ├── .gitignore ├── .husky ├── .gitignore ├── commit-msg └── pre-commit ├── .vscode ├── launch.json └── settings.json ├── CHANGELOG.md ├── LICENSE.txt ├── README.md ├── bin └── cli.js ├── changelog.config.js ├── docs ├── _config.yml ├── _layouts │ └── default.html ├── assets │ ├── css │ │ └── style.scss │ └── img │ │ ├── demo.gif │ │ ├── favicon.ico │ │ ├── formDataOptions.png │ │ ├── logo.png │ │ ├── logo.svg │ │ ├── logoBanner.png │ │ ├── logoBanner.svg │ │ └── variables.png └── index.md ├── lib ├── index.js ├── md-utils.js └── var-replacer.js ├── package-lock.json ├── package.json ├── test ├── cli.spec.js ├── index.spec.js ├── md-utils.spec.js ├── resources │ ├── console │ │ └── help.txt │ ├── input │ │ ├── NoOptionsInBody.json │ │ ├── NullHeaders.json │ │ ├── invalidOptions.txt │ │ ├── issue175.json │ │ ├── options.json │ │ ├── v2 │ │ │ ├── AuthBasic.json │ │ │ ├── AuthBearer.json │ │ │ ├── AuthMultiple.json │ │ │ ├── AuthRequest.json │ │ │ ├── BasepathVar.json │ │ │ ├── CollectionWrapper.json │ │ │ ├── DeleteOperation.json │ │ │ ├── DepthPathParams.json │ │ │ ├── DisabledParams.json │ │ │ ├── EmptyUrl.json │ │ │ ├── ExternalDocs.json │ │ │ ├── FolderCollection.json │ │ │ ├── FormData.json │ │ │ ├── FormUrlencoded.json │ │ │ ├── GetMethods.json │ │ │ ├── Headers.json │ │ │ ├── JsonComments.json │ │ │ ├── LicenseContact.json │ │ │ ├── MultipleServers.json │ │ │ ├── NoPath.json │ │ │ ├── NoVersion.json │ │ │ ├── OperationIds.json │ │ │ ├── ParseStatusCode.json │ │ │ ├── PathParams.json │ │ │ ├── PostmantoOpenAPI.json │ │ │ ├── RawBody.json │ │ │ ├── Responses.json │ │ │ ├── ResponsesEmpty.json │ │ │ ├── ResponsesJsonError.json │ │ │ ├── ResponsesMultiLang.json │ │ │ ├── SimplePost.json │ │ │ ├── UrlWithPort.json │ │ │ ├── Variables.json │ │ │ └── XLogo.json │ │ └── v21 │ │ │ ├── AuthBasic.json │ │ │ ├── AuthBearer.json │ │ │ ├── AuthMultiple.json │ │ │ ├── AuthRequest.json │ │ │ ├── BasepathVar.json │ │ │ ├── CollectionWrapper.json │ │ │ ├── DeleteOperation.json │ │ │ ├── DepthPathParams.json │ │ │ ├── DisabledParams.json │ │ │ ├── EmptyUrl.json │ │ │ ├── ExternalDocs.json │ │ │ ├── FolderCollection.json │ │ │ ├── FormData.json │ │ │ ├── FormUrlencoded.json │ │ │ ├── GetMethods.json │ │ │ ├── Headers.json │ │ │ ├── JsonComments.json │ │ │ ├── LicenseContact.json │ │ │ ├── MultipleServers.json │ │ │ ├── NoPath.json │ │ │ ├── NoVersion.json │ │ │ ├── OperationIds.json │ │ │ ├── ParseStatusCode.json │ │ │ ├── PathParams.json │ │ │ ├── PostmantoOpenAPI.json │ │ │ ├── RawBody.json │ │ │ ├── Responses.json │ │ │ ├── ResponsesEmpty.json │ │ │ ├── ResponsesJsonError.json │ │ │ ├── ResponsesMultiLang.json │ │ │ ├── SimplePost.json │ │ │ ├── UrlWithPort.json │ │ │ ├── Variables.json │ │ │ └── XLogo.json │ ├── options │ │ └── info.json │ ├── output │ │ ├── AuthBasic.yml │ │ ├── AuthBearer.yml │ │ ├── AuthMultiple.yml │ │ ├── AuthOptions.yml │ │ ├── AuthRequest.yml │ │ ├── BasepathVar.yml │ │ ├── Basic.json │ │ ├── Basic.yml │ │ ├── BasicNoOptions.yml │ │ ├── BasicWithAuth.yml │ │ ├── CollectionWrapper.yml │ │ ├── CustomTag.yml │ │ ├── DeleteOperation.yml │ │ ├── DepthPathParams.yml │ │ ├── DisabledParamsAll.yml │ │ ├── DisabledParamsDefault.yml │ │ ├── DisabledParamsHeader.yml │ │ ├── DisabledParamsQuery.yml │ │ ├── EmptyUrl.yml │ │ ├── ExternalDocs.yml │ │ ├── ExternalDocsOpts.yml │ │ ├── ExternalDocsOptsPartial.yml │ │ ├── Folders.yml │ │ ├── FoldersNoConcat.yml │ │ ├── FoldersSeparator.yml │ │ ├── FormData.yml │ │ ├── FormUrlencoded.yml │ │ ├── GetMethods.yml │ │ ├── Headers.yml │ │ ├── InfoOpts.yml │ │ ├── JsonComments.yml │ │ ├── LicenseContact.yml │ │ ├── LicenseContactOpts.yml │ │ ├── LicenseContactPartial.yml │ │ ├── LicenseContactPartial2.yml │ │ ├── MultipleServers.yml │ │ ├── NoPath.yml │ │ ├── NoServers.yml │ │ ├── NoVersion.yml │ │ ├── NullHeader.yml │ │ ├── OperationIds.yml │ │ ├── OperationIdsAuto.yml │ │ ├── OperationIdsBrackets.yml │ │ ├── ParseStatus.yml │ │ ├── PathParams.yml │ │ ├── RawBody.yml │ │ ├── Responses.yml │ │ ├── ResponsesEmpty.yml │ │ ├── ResponsesMultiLang.yml │ │ ├── ResponsesNoHeaders.yml │ │ ├── ServersOpts.yml │ │ ├── UrlWithPort.yml │ │ ├── Variables.yml │ │ ├── VariablesAdditional.yml │ │ ├── XLogo.yml │ │ └── XLogoVar.yml │ └── var-replace │ │ ├── VariablesReplacedV2.json │ │ ├── VariablesReplacedV21.json │ │ ├── VariablesReplacedV21additional.json │ │ └── VariablesReplacedV2additional.json └── var-replacer.spec.js └── types ├── index.d.ts ├── tsconfig.json └── typescript-test.ts /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig defines and maintains consistent coding styles between different 2 | # editors and IDEs: http://EditorConfig.org/ 3 | 4 | # Top-most EditorConfig file 5 | root = true 6 | 7 | # All files 8 | [*] 9 | charset = utf-8 10 | end_of_line = lf 11 | insert_final_newline = true 12 | indent_style = space 13 | indent_size = 2 14 | trim_trailing_whitespace = true 15 | max_line_length = 100 -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "commonjs": true, 5 | "es2021": true 6 | }, 7 | "extends": [ 8 | "standard" 9 | ], 10 | "parserOptions": { 11 | "ecmaVersion": 12 12 | }, 13 | "rules": { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | name: "CodeQL" 2 | 3 | on: 4 | push: 5 | branches: [ master, develop ] 6 | pull_request: 7 | # The branches below must be a subset of the branches above 8 | branches: [ master ] 9 | schedule: 10 | - cron: '23 12 * * 5' 11 | 12 | jobs: 13 | analyze: 14 | name: Analyze 15 | runs-on: ubuntu-latest 16 | permissions: 17 | actions: read 18 | contents: read 19 | security-events: write 20 | 21 | strategy: 22 | fail-fast: false 23 | matrix: 24 | language: [ 'javascript' ] 25 | 26 | steps: 27 | - name: Checkout repository 28 | uses: actions/checkout@v2 29 | 30 | - name: Initialize CodeQL 31 | uses: github/codeql-action/init@v1 32 | with: 33 | languages: ${{ matrix.language }} 34 | 35 | - name: Autobuild 36 | uses: github/codeql-action/autobuild@v1 37 | 38 | - name: Perform CodeQL Analysis 39 | uses: github/codeql-action/analyze@v1 40 | -------------------------------------------------------------------------------- /.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | branches: [ develop, master ] 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | strategy: 11 | matrix: 12 | node-version: [14.x, 16.x, 17.x, 18.x, 19.x] 13 | steps: 14 | - uses: actions/checkout@v2 15 | - name: Use Node.js ${{ matrix.node-version }} 16 | uses: actions/setup-node@v1 17 | with: 18 | node-version: ${{ matrix.node-version }} 19 | - run: npm ci 20 | - run: npm run lint 21 | - run: npm run lint:ts 22 | - run: npm test 23 | - name: Upload coverage to Codecov 24 | uses: codecov/codecov-action@v1 25 | with: 26 | token: ${{ secrets.CODECOV_TOKEN }} 27 | file: ./coverage/lcov.info 28 | flags: unittests 29 | name: codecov-upload 30 | fail_ci_if_error: true 31 | publish: 32 | if: ${{ github.ref == 'refs/heads/master' }} 33 | needs: build 34 | runs-on: ubuntu-latest 35 | steps: 36 | - uses: actions/checkout@v2 37 | - uses: actions/setup-node@v1 38 | with: 39 | node-version: '12.x' 40 | registry-url: 'https://registry.npmjs.org' 41 | - run: npm install 42 | - run: npm publish --access public 43 | env: 44 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 45 | - name: Generate changelog 46 | id: changelog 47 | uses: metcalfc/changelog-generator@v0.4.3 48 | with: 49 | myToken: ${{ secrets.GITHUB_TOKEN }} 50 | - name: Get package version 51 | id: package-version 52 | uses: martinbeentjes/npm-get-version-action@master 53 | - name: Create Release 54 | id: create_release 55 | uses: actions/create-release@latest 56 | env: 57 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 58 | with: 59 | tag_name: ${{ steps.package-version.outputs.current-version }} 60 | release_name: Release ${{ steps.package-version.outputs.current-version }} 61 | body: | 62 | ${{ steps.changelog.outputs.changelog }} 63 | draft: false 64 | prerelease: false -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### Node ### 2 | # Logs 3 | logs 4 | *.log 5 | npm-debug.log* 6 | yarn-debug.log* 7 | yarn-error.log* 8 | lerna-debug.log* 9 | 10 | # Diagnostic reports (https://nodejs.org/api/report.html) 11 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 12 | 13 | # Runtime data 14 | pids 15 | *.pid 16 | *.seed 17 | *.pid.lock 18 | 19 | # Directory for instrumented libs generated by jscoverage/JSCover 20 | lib-cov 21 | 22 | # Coverage directory used by tools like istanbul 23 | coverage 24 | coverage/** 25 | *.lcov 26 | 27 | # nyc test coverage 28 | .nyc_output 29 | 30 | # Dependency directories 31 | node_modules/ 32 | node_modules/* 33 | 34 | # Output of 'npm pack' 35 | *.tgz 36 | 37 | # dotenv environment variables file 38 | .env 39 | .env.test 40 | 41 | # parcel-bundler cache (https://parceljs.org/) 42 | .cache 43 | 44 | .idea 45 | -------------------------------------------------------------------------------- /.husky/.gitignore: -------------------------------------------------------------------------------- 1 | _ 2 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx --no-install commitlint --edit $1 -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npm test 5 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | 8 | { 9 | "type": "pwa-node", 10 | "request": "launch", 11 | "name": "Launch Program", 12 | "skipFiles": [ 13 | "/**" 14 | ], 15 | "program": "${workspaceFolder}/lib/index.js" 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.words": [ 3 | "execa", 4 | "formdata" 5 | ] 6 | } -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Jorge Oliva (joolfe04@gmail.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /bin/cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const { program } = require('commander') 4 | const { version } = require('../package.json') 5 | const postmanToOpenApi = require('../lib') 6 | const { promises: { readFile } } = require('fs') 7 | 8 | const additionalHelp = ` 9 | 10 | Example calls: 11 | $ p2o ./path/to/PostmantoCollection.json -f ./path/to/result.yml -o ./path/to/options.json 12 | 13 | For more info about how to use it visit our documentation in 14 | ` 15 | 16 | program 17 | .version(version, '-v, --vers', 'Output the current version of the library.') 18 | .name('p2o') 19 | .usage(' [options]') 20 | .addHelpText('after', additionalHelp) 21 | .arguments('') 22 | .description('Transform a postman collection to OpenAPI specification yml.', { 23 | collection: 'Relative path to the Postman collection json file' 24 | }) 25 | .option('-f, --file ', 'Relative path to the file where result will be saved. If empty result will be returned by cli.') 26 | .option('-o, --options ', 'Relative path to json file that contain the optional parameters for the transformation.') 27 | .action(async (collection, { file, options }, command) => { 28 | try { 29 | const parsedOptions = await parseOptions(options) 30 | const result = await postmanToOpenApi(collection, file, parsedOptions) 31 | console.info(result) 32 | } catch (err) { 33 | throw new Error(err) 34 | } 35 | }) 36 | 37 | program 38 | .parseAsync() 39 | .catch(err => { 40 | process.exitCode = 1 41 | console.error(err.message) 42 | }) 43 | 44 | async function parseOptions (optionsPath) { 45 | try { 46 | return optionsPath ? JSON.parse(await readFile(optionsPath)) : {} 47 | } catch (err) { 48 | throw new Error(`invalid "options" parameter -> ${err.message}`) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /changelog.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | options: { 3 | preset: { 4 | name: 'conventionalcommits', 5 | types: [ 6 | { type: 'feat', section: 'Features' }, 7 | { type: 'fix', section: 'Bug Fixes' }, 8 | { type: 'perf', section: 'Performance Improvements' }, 9 | { type: 'revert', section: 'Reverts' }, 10 | { type: 'docs', section: 'Documentation' }, 11 | { type: 'style', section: 'Styles' }, 12 | { type: 'chore', section: 'Miscellaneous Chores' }, 13 | { type: 'refactor', section: 'Code Refactoring' }, 14 | { type: 'test', section: 'Tests' }, 15 | { type: 'build', section: 'Build System' }, 16 | { type: 'ci', section: 'Continuous Integration' } 17 | ] 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman 2 | markdown: kramdown 3 | plugins: 4 | - jemoji -------------------------------------------------------------------------------- /docs/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {% seo %} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 25 | 26 |
27 | {{ content }} 28 | 29 | 37 |
38 | 39 | -------------------------------------------------------------------------------- /docs/assets/css/style.scss: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 | $header-bg-color: #ff6b37 !default; 5 | $header-bg-color-secondary: #5f5278 !default; 6 | 7 | $body-link-color: #3b95ef !default; 8 | $section-headings-color: #ff6b37 !default; 9 | 10 | @import "jekyll-theme-cayman"; 11 | 12 | strong { 13 | color: #788286; 14 | } 15 | 16 | .main-content { 17 | 18 | @include large { 19 | max-width: 100%; 20 | padding: 0px; 21 | font-size: 1.1rem; 22 | } 23 | 24 | @include medium { 25 | padding: 0px; 26 | font-size: 1.1rem; 27 | } 28 | 29 | @include small { 30 | padding: 0px; 31 | font-size: 1rem; 32 | } 33 | 34 | .tilted-section { 35 | background-color: #fff; 36 | -webkit-clip-path: polygon(0 0, 100% 4vw, 100% 100%, 100%); 37 | clip-path: polygon(0 0, 100% 4vw, 100% 100%, 0 100%); 38 | margin-top: -4vw; 39 | 40 | @include large { 41 | -webkit-clip-path: polygon(0 0, 100% 3vw, 100% 100%, 0 100%); 42 | clip-path: polygon(0 0, 100% 3vw, 100% 100%, 0 100%); 43 | padding: 4rem 0em; 44 | margin-top: -3vw; 45 | } 46 | 47 | @include medium { 48 | padding: 4rem 0em; 49 | } 50 | 51 | @include small { 52 | padding: 4rem 0em; 53 | } 54 | 55 | > div { 56 | @include large { 57 | max-width: 64rem; 58 | margin: 0 auto; 59 | padding: 0rem 6rem; 60 | } 61 | 62 | @include medium { 63 | padding: 0rem 4rem; 64 | } 65 | 66 | @include small { 67 | padding: 0rem 1rem; 68 | } 69 | } 70 | } 71 | 72 | .tilted-section:nth-of-type(even) { 73 | background-color: #f1f1f3 !important 74 | } 75 | 76 | .site-footer { 77 | color: #fff; 78 | background-color: #1C272B; 79 | margin-top: 0rem; 80 | padding-top: 0em; 81 | 82 | > div { 83 | @include large { 84 | max-width: 64rem; 85 | margin: 0 auto; 86 | padding: 2rem 6rem; 87 | } 88 | 89 | @include medium { 90 | padding: 2rem 4rem; 91 | } 92 | 93 | @include small { 94 | padding: 2rem 1rem; 95 | } 96 | } 97 | } 98 | 99 | } -------------------------------------------------------------------------------- /docs/assets/img/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joolfe/postman-to-openapi/d1823eea9c1795fdc8dfe7c2d7de58ff8ec2cd89/docs/assets/img/demo.gif -------------------------------------------------------------------------------- /docs/assets/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joolfe/postman-to-openapi/d1823eea9c1795fdc8dfe7c2d7de58ff8ec2cd89/docs/assets/img/favicon.ico -------------------------------------------------------------------------------- /docs/assets/img/formDataOptions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joolfe/postman-to-openapi/d1823eea9c1795fdc8dfe7c2d7de58ff8ec2cd89/docs/assets/img/formDataOptions.png -------------------------------------------------------------------------------- /docs/assets/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joolfe/postman-to-openapi/d1823eea9c1795fdc8dfe7c2d7de58ff8ec2cd89/docs/assets/img/logo.png -------------------------------------------------------------------------------- /docs/assets/img/logoBanner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joolfe/postman-to-openapi/d1823eea9c1795fdc8dfe7c2d7de58ff8ec2cd89/docs/assets/img/logoBanner.png -------------------------------------------------------------------------------- /docs/assets/img/variables.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joolfe/postman-to-openapi/d1823eea9c1795fdc8dfe7c2d7de58ff8ec2cd89/docs/assets/img/variables.png -------------------------------------------------------------------------------- /lib/md-utils.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const { marked } = require('marked') 4 | const supHeaders = ['object', 'name', 'description', 'example', 'type', 'required'] 5 | 6 | function parseMdTable (md) { 7 | const parsed = marked.lexer(md) 8 | const table = parsed.find(el => el.type === 'table') 9 | if (table == null) return {} 10 | const { header: rawHeader, rows } = table 11 | const cells = rows.map(row => row.map(e => e.text)) 12 | const header = rawHeader.map(e => e.text) 13 | if (!header.includes('object') || !header.includes('name')) return {} 14 | const headers = header.map(h => supHeaders.includes(h) ? h : false) 15 | const tableObj = cells.reduce((accTable, cell, i) => { 16 | const cellObj = cell.reduce((accCell, field, index) => { 17 | if (headers[index]) { 18 | accCell[headers[index]] = field 19 | } 20 | return accCell 21 | }, {}) 22 | accTable[cellObj.name] = cellObj 23 | return accTable 24 | }, {}) 25 | return tableObj 26 | } 27 | 28 | module.exports = { parseMdTable } 29 | -------------------------------------------------------------------------------- /lib/var-replacer.js: -------------------------------------------------------------------------------- 1 | const Mustache = require('mustache') 2 | 3 | /** 4 | * Rewrite escapedValue() function to not delete undefined variables 5 | */ 6 | Mustache.Writer.prototype.escapedValue = function escapedValue (token, context, config) { 7 | const value = context.lookup(token[1]) || `{{${token[1]}}}` 8 | return String(value) 9 | } 10 | 11 | function replacePostmanVariables (collectionString, additionalVars = {}) { 12 | const postmanJson = JSON.parse(collectionString) 13 | const { variable = [] } = postmanJson 14 | const formatVars = variable.reduce((obj, { key, value }) => { 15 | obj[key] = value 16 | return obj 17 | }, {}) 18 | // Merge collection vars with additional vars 19 | const context = { ...formatVars, ...additionalVars } 20 | return Mustache.render(collectionString, context) 21 | } 22 | 23 | module.exports = replacePostmanVariables 24 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "postman-to-openapi", 3 | "version": "3.0.1", 4 | "description": "Convert postman collection to OpenAPI spec", 5 | "main": "lib/index.js", 6 | "types": "types/index.d.ts", 7 | "bin": { 8 | "p2o": "./bin/cli.js" 9 | }, 10 | "scripts": { 11 | "lint": "eslint **/*.js", 12 | "lint:fix": "eslint **/*.js --fix", 13 | "lint:ts": "tsc --build types", 14 | "test:unit": "mocha", 15 | "test:unit-no-only": "npm run test:unit -- --forbid-only", 16 | "test": "nyc npm run test:unit-no-only", 17 | "changelog:all": "conventional-changelog --config ./changelog.config.js -i CHANGELOG.md -s -r 0", 18 | "changelog": "conventional-changelog --config ./changelog.config.js -i CHANGELOG.md -s", 19 | "prepare": "husky install" 20 | }, 21 | "files": [ 22 | "bin/*", 23 | "lib/*", 24 | "types/*" 25 | ], 26 | "repository": { 27 | "type": "git", 28 | "url": "git+https://github.com/joolfe/postman-to-openapi.git" 29 | }, 30 | "keywords": [ 31 | "swagger", 32 | "OpenAPI", 33 | "postman", 34 | "collection", 35 | "convert", 36 | "converter", 37 | "transform", 38 | "specification", 39 | "yml" 40 | ], 41 | "author": "joolfe04@gmail.com", 42 | "license": "MIT", 43 | "bugs": { 44 | "url": "https://github.com/joolfe/postman-to-openapi/issues" 45 | }, 46 | "homepage": "https://github.com/joolfe/postman-to-openapi#readme", 47 | "devDependencies": { 48 | "@commitlint/cli": "^17.3.0", 49 | "@commitlint/config-conventional": "^17.3.0", 50 | "eslint": "^8.30.0", 51 | "eslint-config-standard": "^17.0.0", 52 | "eslint-plugin-import": "^2.26.0", 53 | "eslint-plugin-n": "^15.6.0", 54 | "eslint-plugin-node": "^11.1.0", 55 | "eslint-plugin-promise": "^6.1.1", 56 | "execa": "^5.1.1", 57 | "husky": "^7.0.4", 58 | "mocha": "^10.2.0", 59 | "nyc": "^15.1.0", 60 | "typescript": "^4.9.4" 61 | }, 62 | "commitlint": { 63 | "extends": [ 64 | "@commitlint/config-conventional" 65 | ] 66 | }, 67 | "engines": { 68 | "node": ">=14 <20" 69 | }, 70 | "nyc": { 71 | "all": true, 72 | "include": [ 73 | "lib/**/*.js", 74 | "test/**/*.js", 75 | "bin/**/*.js" 76 | ], 77 | "exclude": [], 78 | "reporter": [ 79 | "lcovonly", 80 | "html", 81 | "text" 82 | ], 83 | "lines": 90, 84 | "statements": 90, 85 | "functions": 90, 86 | "branches": 90, 87 | "check-coverage": true 88 | }, 89 | "dependencies": { 90 | "commander": "^8.3.0", 91 | "js-yaml": "^4.1.0", 92 | "jsonc-parser": "3.2.0", 93 | "lodash.camelcase": "^4.3.0", 94 | "marked": "^4.2.5", 95 | "mustache": "^4.2.0" 96 | }, 97 | "husky": { 98 | "hooks": { 99 | "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /test/resources/console/help.txt: -------------------------------------------------------------------------------- 1 | Usage: p2o [options] 2 | 3 | Transform a postman collection to OpenAPI specification yml. 4 | 5 | Arguments: 6 | collection Relative path to the Postman collection json file 7 | 8 | Options: 9 | -v, --vers Output the current version of the library. 10 | -f, --file Relative path to the file where result will be 11 | saved. If empty result will be returned by cli. 12 | -o, --options Relative path to json file that contain the optional 13 | parameters for the transformation. 14 | -h, --help display help for command 15 | 16 | 17 | Example calls: 18 | $ p2o ./path/to/PostmantoCollection.json -f ./path/to/result.yml -o ./path/to/options.json 19 | 20 | For more info about how to use it visit our documentation in 21 | -------------------------------------------------------------------------------- /test/resources/input/NoOptionsInBody.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "2a45baa5-352f-4831-8483-1a0fcbc7da37", 4 | "name": "Postman to OpenAPI", 5 | "description": "Mi super test collection from postman", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}" 17 | }, 18 | "url": { 19 | "raw": "https://api.io/users", 20 | "protocol": "https", 21 | "host": [ 22 | "api", 23 | "io" 24 | ], 25 | "path": [ 26 | "users" 27 | ] 28 | }, 29 | "description": "Create a new user into your amazing API" 30 | }, 31 | "response": [] 32 | }, 33 | { 34 | "name": "Create a post", 35 | "request": { 36 | "method": "POST", 37 | "header": [], 38 | "body": { 39 | "mode": "file", 40 | "file": {}, 41 | "options": { 42 | "raw": { 43 | "language": "text" 44 | } 45 | } 46 | }, 47 | "url": { 48 | "raw": "https://api.io/posts", 49 | "protocol": "https", 50 | "host": [ 51 | "api", 52 | "io" 53 | ], 54 | "path": [ 55 | "posts" 56 | ] 57 | } 58 | }, 59 | "response": [] 60 | }, 61 | { 62 | "name": "Create a note", 63 | "request": { 64 | "method": "POST", 65 | "header": [], 66 | "body": { 67 | "mode": "raw", 68 | "raw": "This is an example Note", 69 | "options": { 70 | "raw": { 71 | "language": "text" 72 | } 73 | } 74 | }, 75 | "url": { 76 | "raw": "https://api.io/note", 77 | "protocol": "https", 78 | "host": [ 79 | "api", 80 | "io" 81 | ], 82 | "path": [ 83 | "note" 84 | ] 85 | }, 86 | "description": "Just an example of text raw body" 87 | }, 88 | "response": [] 89 | } 90 | ], 91 | "event": [ 92 | { 93 | "listen": "prerequest", 94 | "script": { 95 | "id": "ef248fcc-2944-4cba-837f-680b10a45b30", 96 | "type": "text/javascript", 97 | "exec": [ 98 | "" 99 | ] 100 | } 101 | }, 102 | { 103 | "listen": "test", 104 | "script": { 105 | "id": "8e7453aa-5712-4a90-bc32-965c7d47906a", 106 | "type": "text/javascript", 107 | "exec": [ 108 | "" 109 | ] 110 | } 111 | } 112 | ], 113 | "variable": [ 114 | { 115 | "id": "d04439bd-c604-4758-bde2-3c873140f38c", 116 | "key": "version", 117 | "value": "1.1.0" 118 | } 119 | ], 120 | "protocolProfileBehavior": {} 121 | } -------------------------------------------------------------------------------- /test/resources/input/invalidOptions.txt: -------------------------------------------------------------------------------- 1 | { 2 | info": { 3 | "title": "Options title", 4 | "version: "6.0.7-beta", 5 | "description": "Description from options", 6 | "termsOfService": "http://tos.myweb.com" 7 | } 8 | } -------------------------------------------------------------------------------- /test/resources/input/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "title": "Options title", 4 | "version": "6.0.7-beta", 5 | "description": "Description from options", 6 | "termsOfService": "http://tos.myweb.com" 7 | } 8 | } -------------------------------------------------------------------------------- /test/resources/input/v2/AuthBasic.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "0f93eca8-921e-4b0d-9ac0-15f96a56eae8", 4 | "name": "AuthBasic", 5 | "description": "Collection to test authorization global", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User Copy", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": "https://api.io/users", 24 | "description": "Create a new user into your amazing API" 25 | }, 26 | "response": [] 27 | }, 28 | { 29 | "name": "Get list of users", 30 | "request": { 31 | "method": "GET", 32 | "header": [], 33 | "url": { 34 | "raw": "https://api.io/users?age=45&name=Jhon&review=true&number=23.56", 35 | "protocol": "https", 36 | "host": [ 37 | "api", 38 | "io" 39 | ], 40 | "path": [ 41 | "users" 42 | ], 43 | "query": [ 44 | { 45 | "key": "age", 46 | "value": "45", 47 | "description": "Filter by age" 48 | }, 49 | { 50 | "key": "name", 51 | "value": "Jhon", 52 | "description": "Filter by name" 53 | }, 54 | { 55 | "key": "review", 56 | "value": "true", 57 | "description": "Indicate if should be reviewed or not" 58 | }, 59 | { 60 | "key": "number", 61 | "value": "23.56", 62 | "description": "This is a number" 63 | } 64 | ] 65 | }, 66 | "description": "Obtain a list of users that fullfill the conditions of the filters" 67 | }, 68 | "response": [] 69 | } 70 | ], 71 | "auth": { 72 | "type": "basic", 73 | "basic": { 74 | "password": "ssss", 75 | "username": "sss" 76 | } 77 | }, 78 | "event": [ 79 | { 80 | "listen": "prerequest", 81 | "script": { 82 | "id": "7b3e1a28-e253-4cd9-ac26-2d9d52092d80", 83 | "type": "text/javascript", 84 | "exec": [ 85 | "" 86 | ] 87 | } 88 | }, 89 | { 90 | "listen": "test", 91 | "script": { 92 | "id": "b50e4ce3-8104-4eb7-bc20-50e6f3f5edab", 93 | "type": "text/javascript", 94 | "exec": [ 95 | "" 96 | ] 97 | } 98 | } 99 | ], 100 | "protocolProfileBehavior": {} 101 | } -------------------------------------------------------------------------------- /test/resources/input/v2/AuthBearer.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "a6565bc1-2576-4f58-ab80-e18d3ed8ae9d", 4 | "name": "AuthBearer", 5 | "description": "Collection to test authorization global", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User Copy", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": "https://api.io/users", 24 | "description": "Create a new user into your amazing API" 25 | }, 26 | "response": [] 27 | }, 28 | { 29 | "name": "Get list of users", 30 | "request": { 31 | "method": "GET", 32 | "header": [], 33 | "url": { 34 | "raw": "https://api.io/users?age=45&name=Jhon&review=true&number=23.56", 35 | "protocol": "https", 36 | "host": [ 37 | "api", 38 | "io" 39 | ], 40 | "path": [ 41 | "users" 42 | ], 43 | "query": [ 44 | { 45 | "key": "age", 46 | "value": "45", 47 | "description": "Filter by age" 48 | }, 49 | { 50 | "key": "name", 51 | "value": "Jhon", 52 | "description": "Filter by name" 53 | }, 54 | { 55 | "key": "review", 56 | "value": "true", 57 | "description": "Indicate if should be reviewed or not" 58 | }, 59 | { 60 | "key": "number", 61 | "value": "23.56", 62 | "description": "This is a number" 63 | } 64 | ] 65 | }, 66 | "description": "Obtain a list of users that fullfill the conditions of the filters" 67 | }, 68 | "response": [] 69 | } 70 | ], 71 | "auth": { 72 | "type": "bearer", 73 | "bearer": { 74 | "token": "YUIHUILOIJOJOJ" 75 | } 76 | }, 77 | "event": [ 78 | { 79 | "listen": "prerequest", 80 | "script": { 81 | "id": "4a789393-4d04-4d39-96dc-ac6b8c0f6215", 82 | "type": "text/javascript", 83 | "exec": [ 84 | "" 85 | ] 86 | } 87 | }, 88 | { 89 | "listen": "test", 90 | "script": { 91 | "id": "8f0b6648-0701-4ba3-b799-5683e33b6213", 92 | "type": "text/javascript", 93 | "exec": [ 94 | "" 95 | ] 96 | } 97 | } 98 | ], 99 | "protocolProfileBehavior": {} 100 | } -------------------------------------------------------------------------------- /test/resources/input/v2/AuthMultiple.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "0444d7cb-6825-4cb5-bde0-4439e33eb825", 4 | "name": "AuthBearer", 5 | "description": "Collection to test authorization global", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User Copy", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": "https://api.io/users", 24 | "description": "Create a new user into your amazing API" 25 | }, 26 | "response": [] 27 | }, 28 | { 29 | "name": "Get list of users", 30 | "request": { 31 | "auth": { 32 | "type": "basic", 33 | "basic": { 34 | "password": "myPassword", 35 | "username": "myUser" 36 | } 37 | }, 38 | "method": "GET", 39 | "header": [], 40 | "url": { 41 | "raw": "https://api.io/users?age=45&name=Jhon&review=true&number=23.56", 42 | "protocol": "https", 43 | "host": [ 44 | "api", 45 | "io" 46 | ], 47 | "path": [ 48 | "users" 49 | ], 50 | "query": [ 51 | { 52 | "key": "age", 53 | "value": "45", 54 | "description": "Filter by age" 55 | }, 56 | { 57 | "key": "name", 58 | "value": "Jhon", 59 | "description": "Filter by name" 60 | }, 61 | { 62 | "key": "review", 63 | "value": "true", 64 | "description": "Indicate if should be reviewed or not" 65 | }, 66 | { 67 | "key": "number", 68 | "value": "23.56", 69 | "description": "This is a number" 70 | } 71 | ] 72 | }, 73 | "description": "Obtain a list of users that fullfill the conditions of the filters" 74 | }, 75 | "response": [] 76 | } 77 | ], 78 | "auth": { 79 | "type": "bearer", 80 | "bearer": { 81 | "token": "YUIHUILOIJOJOJ" 82 | } 83 | }, 84 | "event": [ 85 | { 86 | "listen": "prerequest", 87 | "script": { 88 | "type": "text/javascript", 89 | "exec": [ 90 | "" 91 | ] 92 | } 93 | }, 94 | { 95 | "listen": "test", 96 | "script": { 97 | "type": "text/javascript", 98 | "exec": [ 99 | "" 100 | ] 101 | } 102 | } 103 | ] 104 | } -------------------------------------------------------------------------------- /test/resources/input/v2/AuthRequest.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "4d9c5d4f-0fe4-49a5-9760-4381d965b199", 4 | "name": "AuthRequest", 5 | "description": "Collection to test authorization to request level", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User Copy", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": "https://api.io/users", 24 | "description": "Create a new user into your amazing API" 25 | }, 26 | "response": [] 27 | }, 28 | { 29 | "name": "Get list of users", 30 | "request": { 31 | "auth": { 32 | "type": "basic", 33 | "basic": { 34 | "password": "myPassword", 35 | "username": "myUser" 36 | } 37 | }, 38 | "method": "GET", 39 | "header": [], 40 | "url": { 41 | "raw": "https://api.io/users?age=45&name=Jhon&review=true&number=23.56", 42 | "protocol": "https", 43 | "host": [ 44 | "api", 45 | "io" 46 | ], 47 | "path": [ 48 | "users" 49 | ], 50 | "query": [ 51 | { 52 | "key": "age", 53 | "value": "45", 54 | "description": "Filter by age" 55 | }, 56 | { 57 | "key": "name", 58 | "value": "Jhon", 59 | "description": "Filter by name" 60 | }, 61 | { 62 | "key": "review", 63 | "value": "true", 64 | "description": "Indicate if should be reviewed or not" 65 | }, 66 | { 67 | "key": "number", 68 | "value": "23.56", 69 | "description": "This is a number" 70 | } 71 | ] 72 | }, 73 | "description": "Obtain a list of users that fullfill the conditions of the filters" 74 | }, 75 | "response": [] 76 | } 77 | ], 78 | "event": [ 79 | { 80 | "listen": "prerequest", 81 | "script": { 82 | "type": "text/javascript", 83 | "exec": [ 84 | "" 85 | ] 86 | } 87 | }, 88 | { 89 | "listen": "test", 90 | "script": { 91 | "type": "text/javascript", 92 | "exec": [ 93 | "" 94 | ] 95 | } 96 | } 97 | ] 98 | } -------------------------------------------------------------------------------- /test/resources/input/v2/BasepathVar.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "033eef66-b948-4d5f-8c7b-a38fea9932f4", 4 | "name": "Basepath Var", 5 | "description": "Just a simple collection for test", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": "{{base_url}}/users", 24 | "description": "Create a new user into your amazing API" 25 | }, 26 | "response": [] 27 | }, 28 | { 29 | "name": "Post empty raw", 30 | "request": { 31 | "method": "POST", 32 | "header": [], 33 | "body": { 34 | "mode": "raw", 35 | "raw": "", 36 | "options": { 37 | "raw": { 38 | "language": "json" 39 | } 40 | } 41 | }, 42 | "url": "{{base_url}}/raw", 43 | "description": "Create a new user into your amazing API" 44 | }, 45 | "response": [] 46 | } 47 | ], 48 | "event": [ 49 | { 50 | "listen": "prerequest", 51 | "script": { 52 | "type": "text/javascript", 53 | "exec": [ 54 | "" 55 | ] 56 | } 57 | }, 58 | { 59 | "listen": "test", 60 | "script": { 61 | "type": "text/javascript", 62 | "exec": [ 63 | "" 64 | ] 65 | } 66 | } 67 | ], 68 | "variable": [ 69 | { 70 | "key": "version", 71 | "value": "2.3.0" 72 | } 73 | ] 74 | } -------------------------------------------------------------------------------- /test/resources/input/v2/CollectionWrapper.json: -------------------------------------------------------------------------------- 1 | { 2 | "collection": { 3 | "info": { 4 | "_postman_id": "0f93eca8-921e-4b0d-9ac0-15f96a56eae8", 5 | "name": "AuthBasic", 6 | "description": "Collection to test authorization global", 7 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 8 | }, 9 | "item": [ 10 | { 11 | "name": "Create new User Copy", 12 | "request": { 13 | "method": "POST", 14 | "header": [], 15 | "body": { 16 | "mode": "raw", 17 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 18 | "options": { 19 | "raw": { 20 | "language": "json" 21 | } 22 | } 23 | }, 24 | "url": "https://api.io/users", 25 | "description": "Create a new user into your amazing API" 26 | }, 27 | "response": [] 28 | }, 29 | { 30 | "name": "Get list of users", 31 | "request": { 32 | "method": "GET", 33 | "header": [], 34 | "url": { 35 | "raw": "https://api.io/users?age=45&name=Jhon&review=true&number=23.56", 36 | "protocol": "https", 37 | "host": [ 38 | "api", 39 | "io" 40 | ], 41 | "path": [ 42 | "users" 43 | ], 44 | "query": [ 45 | { 46 | "key": "age", 47 | "value": "45", 48 | "description": "Filter by age" 49 | }, 50 | { 51 | "key": "name", 52 | "value": "Jhon", 53 | "description": "Filter by name" 54 | }, 55 | { 56 | "key": "review", 57 | "value": "true", 58 | "description": "Indicate if should be reviewed or not" 59 | }, 60 | { 61 | "key": "number", 62 | "value": "23.56", 63 | "description": "This is a number" 64 | } 65 | ] 66 | }, 67 | "description": "Obtain a list of users that fullfill the conditions of the filters" 68 | }, 69 | "response": [] 70 | } 71 | ], 72 | "auth": { 73 | "type": "basic", 74 | "basic": { 75 | "password": "ssss", 76 | "username": "sss" 77 | } 78 | }, 79 | "event": [ 80 | { 81 | "listen": "prerequest", 82 | "script": { 83 | "id": "7b3e1a28-e253-4cd9-ac26-2d9d52092d80", 84 | "type": "text/javascript", 85 | "exec": [ 86 | "" 87 | ] 88 | } 89 | }, 90 | { 91 | "listen": "test", 92 | "script": { 93 | "id": "b50e4ce3-8104-4eb7-bc20-50e6f3f5edab", 94 | "type": "text/javascript", 95 | "exec": [ 96 | "" 97 | ] 98 | } 99 | } 100 | ], 101 | "protocolProfileBehavior": {} 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /test/resources/input/v2/DeleteOperation.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "467fe1f5-3fed-4005-bb02-fe6ddfa2c571", 4 | "name": "Delete Operation", 5 | "description": "Mi super test collection from postman", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Delete all users", 11 | "request": { 12 | "method": "DELETE", 13 | "header": [], 14 | "url": "https://api.io/users", 15 | "description": "Delete all the existing users" 16 | }, 17 | "response": [] 18 | } 19 | ], 20 | "event": [ 21 | { 22 | "listen": "prerequest", 23 | "script": { 24 | "id": "4dd38097-bafe-459e-8d88-7e8880c07d61", 25 | "type": "text/javascript", 26 | "exec": [ 27 | "" 28 | ] 29 | } 30 | }, 31 | { 32 | "listen": "test", 33 | "script": { 34 | "id": "cc58acea-2ade-42ce-b0fc-f96fd37b899b", 35 | "type": "text/javascript", 36 | "exec": [ 37 | "" 38 | ] 39 | } 40 | } 41 | ], 42 | "variable": [ 43 | { 44 | "id": "b8ff9254-81e3-432f-9e5a-aea92cf34d7c", 45 | "key": "version", 46 | "value": "1.1.0" 47 | } 48 | ], 49 | "protocolProfileBehavior": {} 50 | } -------------------------------------------------------------------------------- /test/resources/input/v2/DepthPathParams.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "867a6cc8-590e-4892-a56f-e6467650762d", 4 | "name": "Large Path Params", 5 | "description": "Collection to test path parameters", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Get one users info", 11 | "request": { 12 | "method": "GET", 13 | "header": [], 14 | "url": "https://api.io/dev/users/{{user_id}}", 15 | "description": "Obtain a list of users that fullfill the conditions of the filters" 16 | }, 17 | "response": [] 18 | }, 19 | { 20 | "name": "Get descriptions of a user", 21 | "request": { 22 | "method": "GET", 23 | "header": [], 24 | "url": "https://api.io/dev/user/{{user_id}}/desc/", 25 | "description": "Obtain a list of users descriptions\n\n# postman-to-openapi\n\n| object | name | description | required | type | example |\n|--------|----------|--------------------------------|----------|--------|-----------|\n| path | user_id | This is just a user identifier | true | number | 476587598 |" 26 | }, 27 | "response": [] 28 | }, 29 | { 30 | "name": "Get a description from an user", 31 | "request": { 32 | "method": "GET", 33 | "header": [], 34 | "url": "https://api.io/dev/user/{{user_id}}/desc/{{desc_id}}", 35 | "description": "Obtain a list of users descriptions\n\n# postman-to-openapi\n\n| object | name | description | required | type | example |\n|--------|----------|--------------------------------|----------|--------|-----------|\n| path | user_id | This is just a user identifier | true | number | 476587598 |\n| path | desc_id | Description id | true | string | ALMT |" 36 | }, 37 | "response": [] 38 | } 39 | ], 40 | "event": [ 41 | { 42 | "listen": "prerequest", 43 | "script": { 44 | "id": "48730090-58d7-4d00-8370-1507a00e5dce", 45 | "type": "text/javascript", 46 | "exec": [ 47 | "" 48 | ] 49 | } 50 | }, 51 | { 52 | "listen": "test", 53 | "script": { 54 | "id": "c769d644-4ade-4e62-bb4a-809590be46ee", 55 | "type": "text/javascript", 56 | "exec": [ 57 | "" 58 | ] 59 | } 60 | } 61 | ], 62 | "protocolProfileBehavior": {} 63 | } -------------------------------------------------------------------------------- /test/resources/input/v2/DisabledParams.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "43c37e23-7cc8-4e6b-acf1-46396b4f4bfd", 4 | "name": "DisabledParams", 5 | "description": "Test API for disabled parameters feature", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json", 7 | "_exporter_id": "64956" 8 | }, 9 | "item": [ 10 | { 11 | "name": "Get list of users", 12 | "request": { 13 | "method": "GET", 14 | "header": [ 15 | { 16 | "key": "X-My-Header", 17 | "value": "hudjilksns78jsijns090", 18 | "description": "Custom header [required]", 19 | "type": "text" 20 | }, 21 | { 22 | "key": "X-My-Header", 23 | "value": "1234567890", 24 | "description": "Custom header disabled [required]", 25 | "type": "text", 26 | "disabled": true 27 | }, 28 | { 29 | "key": "X-Other", 30 | "value": "other", 31 | "description": "Another header [REQUIRED]", 32 | "type": "text" 33 | }, 34 | { 35 | "key": "No-description", 36 | "value": "header without description", 37 | "type": "text" 38 | }, 39 | { 40 | "key": "No-value", 41 | "value": "", 42 | "description": "header without value", 43 | "type": "text" 44 | }, 45 | { 46 | "key": "X-Disabled-Header", 47 | "value": "QWERTY", 48 | "description": "Disabled parameter", 49 | "type": "text", 50 | "disabled": true 51 | } 52 | ], 53 | "url": { 54 | "raw": "https://api.io/:section/users?name=Jhon&review=true", 55 | "protocol": "https", 56 | "host": [ 57 | "api", 58 | "io" 59 | ], 60 | "path": [ 61 | ":section", 62 | "users" 63 | ], 64 | "query": [ 65 | { 66 | "key": "age", 67 | "value": "45", 68 | "description": "Disabled param", 69 | "disabled": true 70 | }, 71 | { 72 | "key": "name", 73 | "value": "Jhon", 74 | "description": "Filter by name" 75 | }, 76 | { 77 | "key": "review", 78 | "value": "true", 79 | "description": "Indicate if should be reviewed or not" 80 | }, 81 | { 82 | "key": "name", 83 | "value": "Mark", 84 | "description": "Disabled param duplicated", 85 | "disabled": true 86 | } 87 | ], 88 | "variable": [ 89 | { 90 | "key": "section", 91 | "value": "spain", 92 | "description": "A path parameter" 93 | } 94 | ] 95 | }, 96 | "description": "Obtain a list of users that fullfill the conditions of the filters" 97 | }, 98 | "response": [] 99 | } 100 | ], 101 | "event": [ 102 | { 103 | "listen": "prerequest", 104 | "script": { 105 | "type": "text/javascript", 106 | "exec": [ 107 | "" 108 | ] 109 | } 110 | }, 111 | { 112 | "listen": "test", 113 | "script": { 114 | "type": "text/javascript", 115 | "exec": [ 116 | "" 117 | ] 118 | } 119 | } 120 | ] 121 | } -------------------------------------------------------------------------------- /test/resources/input/v2/EmptyUrl.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "e223ab3f-2683-4759-9e41-8167a7caaf99", 4 | "name": "Simple Post", 5 | "description": "Just a simple collection for test", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": "https://api.io/users", 24 | "description": "Create a new user into your amazing API" 25 | }, 26 | "response": [] 27 | }, 28 | { 29 | "name": "Post empty raw", 30 | "request": { 31 | "method": "POST", 32 | "header": [], 33 | "body": { 34 | "mode": "raw", 35 | "raw": "", 36 | "options": { 37 | "raw": { 38 | "language": "json" 39 | } 40 | } 41 | }, 42 | "url": "", 43 | "description": "Create a new user into your amazing API" 44 | }, 45 | "response": [] 46 | } 47 | ], 48 | "variable": [ 49 | { 50 | "key": "version", 51 | "value": "2.3.0" 52 | } 53 | ] 54 | } -------------------------------------------------------------------------------- /test/resources/input/v2/ExternalDocs.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "3c770257-049e-41c1-bc50-7b08e0ee4048", 4 | "name": "External Docs", 5 | "description": "Just a simple collection for test", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": "https://api.io/users", 24 | "description": "Create a new user into your amazing API" 25 | }, 26 | "response": [] 27 | } 28 | ], 29 | "event": [ 30 | { 31 | "listen": "prerequest", 32 | "script": { 33 | "id": "990c4de2-f783-45af-9b58-55f044b43e17", 34 | "type": "text/javascript", 35 | "exec": [ 36 | "" 37 | ] 38 | } 39 | }, 40 | { 41 | "listen": "test", 42 | "script": { 43 | "id": "6314f41c-4c4e-4559-9692-4f0d71ce5c98", 44 | "type": "text/javascript", 45 | "exec": [ 46 | "" 47 | ] 48 | } 49 | } 50 | ], 51 | "variable": [ 52 | { 53 | "id": "c47e2327-36d0-44c6-b090-3072409a6e95", 54 | "key": "version", 55 | "value": "2.3.0" 56 | }, 57 | { 58 | "id": "dc8d722e-fa9a-40df-b1a0-6b1037a35c1c", 59 | "key": "externalDocs.url", 60 | "value": "https://docs.example.com" 61 | }, 62 | { 63 | "id": "ae2c8a76-f242-4b07-ac92-595918432bbf", 64 | "key": "externalDocs.description", 65 | "value": "Find more info here" 66 | } 67 | ], 68 | "protocolProfileBehavior": {} 69 | } -------------------------------------------------------------------------------- /test/resources/input/v2/FormData.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "66fd929e-c84f-4bc5-970a-60231fe16f5b", 4 | "name": "Form Data", 5 | "description": "Just a collection with a form data post for test", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Register New User", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "formdata", 16 | "formdata": [ 17 | { 18 | "key": "name", 19 | "value": "New User", 20 | "description": "full name of the user (accepts spaces) [required]", 21 | "type": "text" 22 | }, 23 | { 24 | "key": "email", 25 | "value": "newuser@example.com", 26 | "description": "email of the user (for notifications and login) [required]", 27 | "type": "text" 28 | }, 29 | { 30 | "key": "password", 31 | "value": "pasword123", 32 | "type": "text" 33 | }, 34 | { 35 | "key": "profileImage", 36 | "description": "User avatar", 37 | "contentType": "application/octet-stream", 38 | "type": "file", 39 | "src": [] 40 | } 41 | ] 42 | }, 43 | "url": "https://api.io/register" 44 | }, 45 | "response": [] 46 | } 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /test/resources/input/v2/FormUrlencoded.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "c7890cb4-aa39-4569-9701-a9d6f4abc750", 4 | "name": "Form Url Encoded", 5 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 6 | }, 7 | "item": [ 8 | { 9 | "name": "Register New User", 10 | "request": { 11 | "method": "POST", 12 | "header": [], 13 | "body": { 14 | "mode": "urlencoded", 15 | "urlencoded": [ 16 | { 17 | "key": "name", 18 | "value": "New User", 19 | "description": "full name of the user (accepts spaces) [required]", 20 | "type": "text" 21 | }, 22 | { 23 | "key": "email", 24 | "value": "newuser@example.com", 25 | "description": "email of the user (for notifications and login) [required]", 26 | "type": "text" 27 | }, 28 | { 29 | "key": "password", 30 | "value": "pasword123", 31 | "description": "password (to be used for logging in) [required]", 32 | "type": "text" 33 | } 34 | ] 35 | }, 36 | "url": "https://api.io/register" 37 | }, 38 | "response": [] 39 | } 40 | ] 41 | } -------------------------------------------------------------------------------- /test/resources/input/v2/GetMethods.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "284c15b0-304f-4875-9f36-7a3cf96fca64", 4 | "name": "Get Methods", 5 | "description": "API to manage GET methods", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Get list of users", 11 | "request": { 12 | "method": "GET", 13 | "header": [], 14 | "url": { 15 | "raw": "https://api.io/users?age=45&name=Jhon&review=true&number=23.56&required=my value&number1=0.4565876&number2=123.45&fake-number=1.23.45&date=2022-06-23T10:00:00.000+01:00", 16 | "protocol": "https", 17 | "host": [ 18 | "api", 19 | "io" 20 | ], 21 | "path": [ 22 | "users" 23 | ], 24 | "query": [ 25 | { 26 | "key": "age", 27 | "value": "45", 28 | "description": "Filter by age [required]" 29 | }, 30 | { 31 | "key": "name", 32 | "value": "Jhon", 33 | "description": "Filter by name [REQUIRED]" 34 | }, 35 | { 36 | "key": "review", 37 | "value": "true", 38 | "description": "Indicate if should be reviewed or not" 39 | }, 40 | { 41 | "key": "number", 42 | "value": "23.56", 43 | "description": "This is a number" 44 | }, 45 | { 46 | "key": "required", 47 | "value": "my value", 48 | "description": "[required] mandatory paraemeter" 49 | }, 50 | { 51 | "key": "number1", 52 | "value": "0.4565876", 53 | "description": "Should be parsed as number" 54 | }, 55 | { 56 | "key": "number2", 57 | "value": "123.45", 58 | "description": "Should be parsed as number" 59 | }, 60 | { 61 | "key": "fake-number", 62 | "value": "1.23.45", 63 | "description": "Should be parsed as string" 64 | }, 65 | { 66 | "key": "date", 67 | "value": "2022-06-23T10:00:00.000+01:00", 68 | "description": "Should be parsed as string" 69 | } 70 | ] 71 | }, 72 | "description": "Obtain a list of users that fullfill the conditions of the filters" 73 | }, 74 | "response": [] 75 | } 76 | ], 77 | "event": [ 78 | { 79 | "listen": "prerequest", 80 | "script": { 81 | "id": "48a08854-1364-4bf5-8c52-2987ae771f81", 82 | "type": "text/javascript", 83 | "exec": [ 84 | "" 85 | ] 86 | } 87 | }, 88 | { 89 | "listen": "test", 90 | "script": { 91 | "id": "9414d1c7-923e-4370-8b43-adb8415092c7", 92 | "type": "text/javascript", 93 | "exec": [ 94 | "" 95 | ] 96 | } 97 | } 98 | ], 99 | "protocolProfileBehavior": {} 100 | } -------------------------------------------------------------------------------- /test/resources/input/v2/Headers.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "4ae5252b-8f18-4a03-a4e6-41dac2480a78", 4 | "name": "Headers", 5 | "description": "API with headers", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Get list of users", 11 | "request": { 12 | "method": "GET", 13 | "header": [ 14 | { 15 | "key": "X-My-Header", 16 | "value": "hudjilksns78jsijns090", 17 | "description": "Custom header [required]", 18 | "type": "text" 19 | }, 20 | { 21 | "key": "X-Other", 22 | "value": "other", 23 | "description": "Another header [REQUIRED]", 24 | "type": "text" 25 | }, 26 | { 27 | "key": "No-description", 28 | "value": "header without description", 29 | "type": "text" 30 | }, 31 | { 32 | "key": "No-value", 33 | "value": "", 34 | "description": "header without value", 35 | "type": "text" 36 | } 37 | ], 38 | "url": { 39 | "raw": "https://api.io/users?name=Jhon&review=true", 40 | "protocol": "https", 41 | "host": [ 42 | "api", 43 | "io" 44 | ], 45 | "path": [ 46 | "users" 47 | ], 48 | "query": [ 49 | { 50 | "key": "age", 51 | "value": "45", 52 | "description": "Filter by age", 53 | "disabled": true 54 | }, 55 | { 56 | "key": "name", 57 | "value": "Jhon", 58 | "description": "Filter by name" 59 | }, 60 | { 61 | "key": "review", 62 | "value": "true", 63 | "description": "Indicate if should be reviewed or not" 64 | } 65 | ] 66 | }, 67 | "description": "Obtain a list of users that fullfill the conditions of the filters" 68 | }, 69 | "response": [] 70 | }, 71 | { 72 | "name": "Create new User", 73 | "request": { 74 | "method": "POST", 75 | "header": [ 76 | { 77 | "key": "Content-Type", 78 | "value": "application/json", 79 | "description": "Indicate the type of body sent by client", 80 | "type": "text" 81 | }, 82 | { 83 | "key": "X-My-Header", 84 | "value": "hudjilksns78jsijns090", 85 | "description": "Custom header", 86 | "type": "text" 87 | } 88 | ], 89 | "body": { 90 | "mode": "raw", 91 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 92 | "options": { 93 | "raw": { 94 | "language": "json" 95 | } 96 | } 97 | }, 98 | "url": "https://api.io/users", 99 | "description": "Create a new user into your amazing API" 100 | }, 101 | "response": [] 102 | } 103 | ], 104 | "event": [ 105 | { 106 | "listen": "prerequest", 107 | "script": { 108 | "id": "b20368dc-8b15-4c5f-826f-4e91bb287d09", 109 | "type": "text/javascript", 110 | "exec": [ 111 | "" 112 | ] 113 | } 114 | }, 115 | { 116 | "listen": "test", 117 | "script": { 118 | "id": "46cbfa9e-e283-4d4f-8915-4d13a958d2e9", 119 | "type": "text/javascript", 120 | "exec": [ 121 | "" 122 | ] 123 | } 124 | } 125 | ], 126 | "protocolProfileBehavior": {} 127 | } -------------------------------------------------------------------------------- /test/resources/input/v2/LicenseContact.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "cb2ca622-ddc3-4f90-a7c1-342f5f13a721", 4 | "name": "License and Contact", 5 | "description": "Collection to test license as variable", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Get list of users", 11 | "request": { 12 | "method": "GET", 13 | "header": [], 14 | "url": { 15 | "raw": "https://api.io/users?age=45&name=Jhon&review=true&number=23.56", 16 | "protocol": "https", 17 | "host": [ 18 | "api", 19 | "io" 20 | ], 21 | "path": [ 22 | "users" 23 | ], 24 | "query": [ 25 | { 26 | "key": "age", 27 | "value": "45", 28 | "description": "Filter by age" 29 | }, 30 | { 31 | "key": "name", 32 | "value": "Jhon", 33 | "description": "Filter by name" 34 | }, 35 | { 36 | "key": "review", 37 | "value": "true", 38 | "description": "Indicate if should be reviewed or not" 39 | }, 40 | { 41 | "key": "number", 42 | "value": "23.56", 43 | "description": "This is a number" 44 | } 45 | ] 46 | }, 47 | "description": "Obtain a list of users that fullfill the conditions of the filters" 48 | }, 49 | "response": [] 50 | } 51 | ], 52 | "event": [ 53 | { 54 | "listen": "prerequest", 55 | "script": { 56 | "id": "19996b55-b646-45d4-b168-a1042a110053", 57 | "type": "text/javascript", 58 | "exec": [ 59 | "" 60 | ] 61 | } 62 | }, 63 | { 64 | "listen": "test", 65 | "script": { 66 | "id": "1f32ddda-e7de-4453-9fd7-53ba18a5c058", 67 | "type": "text/javascript", 68 | "exec": [ 69 | "" 70 | ] 71 | } 72 | } 73 | ], 74 | "variable": [ 75 | { 76 | "id": "b573c8e4-6a13-4d0e-8c3b-19536462f36c", 77 | "key": "license.name", 78 | "value": "Apache 2.0" 79 | }, 80 | { 81 | "id": "b1aecf73-5ff1-4cea-b447-80fe28da62c1", 82 | "key": "license.url", 83 | "value": "https://www.apache.org/licenses/LICENSE-2.0.html" 84 | }, 85 | { 86 | "id": "35641083-7bd6-4c98-b2a8-4b45da0cdeb9", 87 | "key": "contact.name", 88 | "value": "API Support" 89 | }, 90 | { 91 | "id": "7762d7a2-78f9-46eb-bf99-2a9519f35a79", 92 | "key": "contact.url", 93 | "value": "http://www.example.com/support" 94 | }, 95 | { 96 | "id": "77c31f06-45ae-40ef-9734-1b03b7bd21fc", 97 | "key": "contact.email", 98 | "value": "support@example.com" 99 | } 100 | ], 101 | "protocolProfileBehavior": {} 102 | } -------------------------------------------------------------------------------- /test/resources/input/v2/MultipleServers.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "e2b55c45-a50d-4421-a575-e8e863b8f4d6", 4 | "name": "MultipleServers", 5 | "description": "Collection to test multiples server parsing.", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": "https://api.io/users", 24 | "description": "Create a new user into your amazing API" 25 | }, 26 | "response": [] 27 | }, 28 | { 29 | "name": "Create a post", 30 | "request": { 31 | "method": "POST", 32 | "header": [], 33 | "body": { 34 | "mode": "file", 35 | "file": {}, 36 | "options": { 37 | "raw": { 38 | "language": "text" 39 | } 40 | } 41 | }, 42 | "url": "https://api.dev.io/posts" 43 | }, 44 | "response": [] 45 | }, 46 | { 47 | "name": "Create a note", 48 | "request": { 49 | "method": "POST", 50 | "header": [], 51 | "body": { 52 | "mode": "raw", 53 | "raw": "This is an example Note", 54 | "options": { 55 | "raw": { 56 | "language": "text" 57 | } 58 | } 59 | }, 60 | "url": "https://api.pre.io/note", 61 | "description": "Just an example of text raw body" 62 | }, 63 | "response": [] 64 | }, 65 | { 66 | "name": "Update User", 67 | "request": { 68 | "method": "PUT", 69 | "header": [], 70 | "body": { 71 | "mode": "raw", 72 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 73 | "options": { 74 | "raw": { 75 | "language": "json" 76 | } 77 | } 78 | }, 79 | "url": "https://api.io/users", 80 | "description": "Update an existing user" 81 | }, 82 | "response": [] 83 | } 84 | ], 85 | "event": [ 86 | { 87 | "listen": "prerequest", 88 | "script": { 89 | "id": "54be283a-e8f1-42b9-82ab-8904e9e38d8a", 90 | "type": "text/javascript", 91 | "exec": [ 92 | "" 93 | ] 94 | } 95 | }, 96 | { 97 | "listen": "test", 98 | "script": { 99 | "id": "3e532569-4da0-4ed4-90cc-46b53421c532", 100 | "type": "text/javascript", 101 | "exec": [ 102 | "" 103 | ] 104 | } 105 | } 106 | ], 107 | "variable": [ 108 | { 109 | "id": "600f8632-5dfe-418b-83cd-f00302a437c0", 110 | "key": "version", 111 | "value": "1.1.0" 112 | } 113 | ], 114 | "protocolProfileBehavior": {} 115 | } -------------------------------------------------------------------------------- /test/resources/input/v2/NoPath.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "070cfcaa-7648-440a-9496-b6d1a7165e71", 4 | "name": "No Path", 5 | "description": "API to manage GET methods", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Get list of users", 11 | "request": { 12 | "method": "GET", 13 | "header": [], 14 | "url": { 15 | "raw": "https://api.io?age=45&name=Jhon&review=true&number=23.56&required=my value", 16 | "protocol": "https", 17 | "host": [ 18 | "api", 19 | "io" 20 | ], 21 | "query": [ 22 | { 23 | "key": "age", 24 | "value": "45", 25 | "description": "Filter by age [required]" 26 | }, 27 | { 28 | "key": "name", 29 | "value": "Jhon", 30 | "description": "Filter by name [REQUIRED]" 31 | }, 32 | { 33 | "key": "review", 34 | "value": "true", 35 | "description": "Indicate if should be reviewed or not" 36 | }, 37 | { 38 | "key": "number", 39 | "value": "23.56", 40 | "description": "This is a number" 41 | }, 42 | { 43 | "key": "required", 44 | "value": "my value", 45 | "description": "[required] mandatory paraemeter" 46 | } 47 | ] 48 | }, 49 | "description": "Obtain a list of users that fullfill the conditions of the filters" 50 | }, 51 | "response": [] 52 | } 53 | ], 54 | "event": [ 55 | { 56 | "listen": "prerequest", 57 | "script": { 58 | "id": "e24b3815-bc32-4604-84d7-809318923959", 59 | "type": "text/javascript", 60 | "exec": [ 61 | "" 62 | ] 63 | } 64 | }, 65 | { 66 | "listen": "test", 67 | "script": { 68 | "id": "dc987fcc-80bc-4750-a13e-60cbd2b47eb1", 69 | "type": "text/javascript", 70 | "exec": [ 71 | "" 72 | ] 73 | } 74 | } 75 | ], 76 | "protocolProfileBehavior": {} 77 | } -------------------------------------------------------------------------------- /test/resources/input/v2/NoVersion.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "75f8c310-4c27-4fab-821a-7b9363596eed", 4 | "name": "No Version Collection", 5 | "description": "This collection don't have a version as variable", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": "https://api.io/users", 24 | "description": "Create a new user into your amazing API" 25 | }, 26 | "response": [] 27 | } 28 | ], 29 | "protocolProfileBehavior": {} 30 | } -------------------------------------------------------------------------------- /test/resources/input/v2/OperationIds.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "030b673d-ddb2-4217-914c-46890cf112cc", 4 | "name": "OperationIds", 5 | "description": "Mi super test collection from postman", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json", 7 | "_exporter_id": "64956" 8 | }, 9 | "item": [ 10 | { 11 | "name": "Create new User", 12 | "request": { 13 | "method": "POST", 14 | "header": [], 15 | "body": { 16 | "mode": "raw", 17 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 18 | "options": { 19 | "raw": { 20 | "language": "json" 21 | } 22 | } 23 | }, 24 | "url": "https://api.io/users", 25 | "description": "Create a new user into your amazing API" 26 | }, 27 | "response": [] 28 | }, 29 | { 30 | "name": "Create a post [createPost]", 31 | "request": { 32 | "method": "POST", 33 | "header": [], 34 | "body": { 35 | "mode": "file", 36 | "file": {} 37 | }, 38 | "url": "https://api.io/posts" 39 | }, 40 | "response": [] 41 | }, 42 | { 43 | "name": "Create a note [createNote]", 44 | "request": { 45 | "method": "POST", 46 | "header": [], 47 | "body": { 48 | "mode": "raw", 49 | "raw": "This is an example Note", 50 | "options": { 51 | "raw": { 52 | "language": "text" 53 | } 54 | } 55 | }, 56 | "url": "https://api.io/note", 57 | "description": "Just an example of text raw body" 58 | }, 59 | "response": [] 60 | } 61 | ], 62 | "event": [ 63 | { 64 | "listen": "prerequest", 65 | "script": { 66 | "type": "text/javascript", 67 | "exec": [ 68 | "" 69 | ] 70 | } 71 | }, 72 | { 73 | "listen": "test", 74 | "script": { 75 | "type": "text/javascript", 76 | "exec": [ 77 | "" 78 | ] 79 | } 80 | } 81 | ], 82 | "variable": [ 83 | { 84 | "key": "version", 85 | "value": "1.1.0" 86 | } 87 | ] 88 | } -------------------------------------------------------------------------------- /test/resources/input/v2/PostmantoOpenAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "eff74bc8-3567-4ce7-9052-e215f085cb12", 4 | "name": "Postman to OpenAPI", 5 | "description": "Mi super test collection from postman", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": "https://api.io/users", 24 | "description": "Create a new user into your amazing API" 25 | }, 26 | "response": [] 27 | }, 28 | { 29 | "name": "Create a post", 30 | "request": { 31 | "method": "POST", 32 | "header": [], 33 | "body": { 34 | "mode": "file", 35 | "file": {}, 36 | "options": { 37 | "raw": { 38 | "language": "text" 39 | } 40 | } 41 | }, 42 | "url": "https://api.io/posts" 43 | }, 44 | "response": [] 45 | }, 46 | { 47 | "name": "Create a note", 48 | "request": { 49 | "method": "POST", 50 | "header": [], 51 | "body": { 52 | "mode": "raw", 53 | "raw": "This is an example Note", 54 | "options": { 55 | "raw": { 56 | "language": "text" 57 | } 58 | } 59 | }, 60 | "url": "https://api.io/note", 61 | "description": "Just an example of text raw body" 62 | }, 63 | "response": [] 64 | }, 65 | { 66 | "name": "No url request", 67 | "request": { 68 | "method": "GET", 69 | "header": [] 70 | }, 71 | "response": [] 72 | } 73 | ], 74 | "event": [ 75 | { 76 | "listen": "prerequest", 77 | "script": { 78 | "id": "58e69c41-03fc-46b0-b701-b07c71a1e9ea", 79 | "type": "text/javascript", 80 | "exec": [ 81 | "" 82 | ] 83 | } 84 | }, 85 | { 86 | "listen": "test", 87 | "script": { 88 | "id": "344bfa97-abab-441b-97c7-aba4f2e0fe2d", 89 | "type": "text/javascript", 90 | "exec": [ 91 | "" 92 | ] 93 | } 94 | } 95 | ], 96 | "variable": [ 97 | { 98 | "id": "d04439bd-c604-4758-bde2-3c873140f38c", 99 | "key": "version", 100 | "value": "1.1.0" 101 | } 102 | ], 103 | "protocolProfileBehavior": {} 104 | } -------------------------------------------------------------------------------- /test/resources/input/v2/RawBody.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "b9a3a079-e781-4cb5-9ae6-009640952df5", 4 | "name": "Raw Body", 5 | "description": "Mi super test collection from postman", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Test Raw Body", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "testesttestest", 17 | "options": { 18 | "raw": { 19 | "language": "text" 20 | } 21 | } 22 | }, 23 | "url": "https://api.io/test", 24 | "description": "Test Raw Body" 25 | }, 26 | "response": [] 27 | } 28 | ], 29 | "event": [ 30 | { 31 | "listen": "prerequest", 32 | "script": { 33 | "type": "text/javascript", 34 | "exec": [ 35 | "" 36 | ] 37 | } 38 | }, 39 | { 40 | "listen": "test", 41 | "script": { 42 | "type": "text/javascript", 43 | "exec": [ 44 | "" 45 | ] 46 | } 47 | } 48 | ] 49 | } -------------------------------------------------------------------------------- /test/resources/input/v2/SimplePost.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "e223ab3f-2683-4759-9e41-8167a7caaf99", 4 | "name": "Simple Post", 5 | "description": "Just a simple collection for test", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": "https://api.io/users", 24 | "description": "Create a new user into your amazing API" 25 | }, 26 | "response": [] 27 | }, 28 | { 29 | "name": "Post empty raw", 30 | "request": { 31 | "method": "POST", 32 | "header": [], 33 | "body": { 34 | "mode": "raw", 35 | "raw": "", 36 | "options": { 37 | "raw": { 38 | "language": "json" 39 | } 40 | } 41 | }, 42 | "url": "https://api.io/raw", 43 | "description": "Create a new user into your amazing API" 44 | }, 45 | "response": [] 46 | } 47 | ], 48 | "variable": [ 49 | { 50 | "key": "version", 51 | "value": "2.3.0" 52 | } 53 | ] 54 | } -------------------------------------------------------------------------------- /test/resources/input/v2/UrlWithPort.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "b1be28f8-d097-4024-b88a-4bbb5c9cde3d", 4 | "name": "Url with Port", 5 | "description": "Just a simple collection for test", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": "https://api.io:453/users", 24 | "description": "Create a new user into your amazing API" 25 | }, 26 | "response": [] 27 | } 28 | ], 29 | "variable": [ 30 | { 31 | "id": "a1b68638-d65e-4ee8-9a91-4d5749e9c2f2", 32 | "key": "version", 33 | "value": "2.3.0" 34 | } 35 | ], 36 | "protocolProfileBehavior": {} 37 | } -------------------------------------------------------------------------------- /test/resources/input/v2/XLogo.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "e223ab3f-2683-4759-9e41-8167a7caaf99", 4 | "name": "Simple Post", 5 | "description": "Just a simple collection for test", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": "https://api.io/users", 24 | "description": "Create a new user into your amazing API" 25 | }, 26 | "response": [] 27 | }, 28 | { 29 | "name": "Post empty raw", 30 | "request": { 31 | "method": "POST", 32 | "header": [], 33 | "body": { 34 | "mode": "raw", 35 | "raw": "", 36 | "options": { 37 | "raw": { 38 | "language": "json" 39 | } 40 | } 41 | }, 42 | "url": "https://api.io/raw", 43 | "description": "Create a new user into your amazing API" 44 | }, 45 | "response": [] 46 | } 47 | ], 48 | "event": [ 49 | { 50 | "listen": "prerequest", 51 | "script": { 52 | "type": "text/javascript", 53 | "exec": [ 54 | "" 55 | ] 56 | } 57 | }, 58 | { 59 | "listen": "test", 60 | "script": { 61 | "type": "text/javascript", 62 | "exec": [ 63 | "" 64 | ] 65 | } 66 | } 67 | ], 68 | "variable": [ 69 | { 70 | "key": "version", 71 | "value": "2.3.0" 72 | }, 73 | { 74 | "key": "x-logo.urlVar", 75 | "value": "https://github.com/joolfe/mylogo.png" 76 | }, 77 | { 78 | "key": "x-logo.backgroundColorVar", 79 | "value": "#000FFF" 80 | }, 81 | { 82 | "key": "x-logo.altTextVar", 83 | "value": "Othert text for logo" 84 | }, 85 | { 86 | "key": "x-logo.hrefVar", 87 | "value": "https://github.com/joolfe/here.html" 88 | } 89 | ] 90 | } -------------------------------------------------------------------------------- /test/resources/input/v21/AuthBasic.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "2c1cccde-7a4d-4dea-bcd8-ce39544b0432", 4 | "name": "AuthBasic", 5 | "description": "Collection to test authorization global", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User Copy", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": { 24 | "raw": "https://api.io/users", 25 | "protocol": "https", 26 | "host": [ 27 | "api", 28 | "io" 29 | ], 30 | "path": [ 31 | "users" 32 | ] 33 | }, 34 | "description": "Create a new user into your amazing API" 35 | }, 36 | "response": [] 37 | }, 38 | { 39 | "name": "Get list of users", 40 | "request": { 41 | "method": "GET", 42 | "header": [], 43 | "url": { 44 | "raw": "https://api.io/users?age=45&name=Jhon&review=true&number=23.56", 45 | "protocol": "https", 46 | "host": [ 47 | "api", 48 | "io" 49 | ], 50 | "path": [ 51 | "users" 52 | ], 53 | "query": [ 54 | { 55 | "key": "age", 56 | "value": "45", 57 | "description": "Filter by age" 58 | }, 59 | { 60 | "key": "name", 61 | "value": "Jhon", 62 | "description": "Filter by name" 63 | }, 64 | { 65 | "key": "review", 66 | "value": "true", 67 | "description": "Indicate if should be reviewed or not" 68 | }, 69 | { 70 | "key": "number", 71 | "value": "23.56", 72 | "description": "This is a number" 73 | } 74 | ] 75 | }, 76 | "description": "Obtain a list of users that fullfill the conditions of the filters" 77 | }, 78 | "response": [] 79 | } 80 | ], 81 | "auth": { 82 | "type": "basic", 83 | "basic": [ 84 | { 85 | "key": "password", 86 | "value": "ssss", 87 | "type": "string" 88 | }, 89 | { 90 | "key": "username", 91 | "value": "sss", 92 | "type": "string" 93 | } 94 | ] 95 | }, 96 | "event": [ 97 | { 98 | "listen": "prerequest", 99 | "script": { 100 | "id": "631b8a30-dcaf-449a-9f2e-83a9f13044ae", 101 | "type": "text/javascript", 102 | "exec": [ 103 | "" 104 | ] 105 | } 106 | }, 107 | { 108 | "listen": "test", 109 | "script": { 110 | "id": "b43e5a36-2b9e-47a0-aab9-edc036b968a6", 111 | "type": "text/javascript", 112 | "exec": [ 113 | "" 114 | ] 115 | } 116 | } 117 | ], 118 | "protocolProfileBehavior": {} 119 | } -------------------------------------------------------------------------------- /test/resources/input/v21/AuthBearer.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "2c1cccde-7a4d-4dea-bcd8-ce39544b0432", 4 | "name": "AuthBearer", 5 | "description": "Collection to test authorization global", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User Copy", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": { 24 | "raw": "https://api.io/users", 25 | "protocol": "https", 26 | "host": [ 27 | "api", 28 | "io" 29 | ], 30 | "path": [ 31 | "users" 32 | ] 33 | }, 34 | "description": "Create a new user into your amazing API" 35 | }, 36 | "response": [] 37 | }, 38 | { 39 | "name": "Get list of users", 40 | "request": { 41 | "method": "GET", 42 | "header": [], 43 | "url": { 44 | "raw": "https://api.io/users?age=45&name=Jhon&review=true&number=23.56", 45 | "protocol": "https", 46 | "host": [ 47 | "api", 48 | "io" 49 | ], 50 | "path": [ 51 | "users" 52 | ], 53 | "query": [ 54 | { 55 | "key": "age", 56 | "value": "45", 57 | "description": "Filter by age" 58 | }, 59 | { 60 | "key": "name", 61 | "value": "Jhon", 62 | "description": "Filter by name" 63 | }, 64 | { 65 | "key": "review", 66 | "value": "true", 67 | "description": "Indicate if should be reviewed or not" 68 | }, 69 | { 70 | "key": "number", 71 | "value": "23.56", 72 | "description": "This is a number" 73 | } 74 | ] 75 | }, 76 | "description": "Obtain a list of users that fullfill the conditions of the filters" 77 | }, 78 | "response": [] 79 | } 80 | ], 81 | "auth": { 82 | "type": "bearer", 83 | "bearer": [ 84 | { 85 | "key": "token", 86 | "value": "YUIHUILOIJOJOJ", 87 | "type": "string" 88 | } 89 | ] 90 | }, 91 | "event": [ 92 | { 93 | "listen": "prerequest", 94 | "script": { 95 | "id": "631b8a30-dcaf-449a-9f2e-83a9f13044ae", 96 | "type": "text/javascript", 97 | "exec": [ 98 | "" 99 | ] 100 | } 101 | }, 102 | { 103 | "listen": "test", 104 | "script": { 105 | "id": "b43e5a36-2b9e-47a0-aab9-edc036b968a6", 106 | "type": "text/javascript", 107 | "exec": [ 108 | "" 109 | ] 110 | } 111 | } 112 | ], 113 | "protocolProfileBehavior": {} 114 | } -------------------------------------------------------------------------------- /test/resources/input/v21/AuthMultiple.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "0444d7cb-6825-4cb5-bde0-4439e33eb825", 4 | "name": "AuthBearer", 5 | "description": "Collection to test authorization global", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User Copy", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": { 24 | "raw": "https://api.io/users", 25 | "protocol": "https", 26 | "host": [ 27 | "api", 28 | "io" 29 | ], 30 | "path": [ 31 | "users" 32 | ] 33 | }, 34 | "description": "Create a new user into your amazing API" 35 | }, 36 | "response": [] 37 | }, 38 | { 39 | "name": "Get list of users", 40 | "request": { 41 | "auth": { 42 | "type": "basic", 43 | "basic": [ 44 | { 45 | "key": "password", 46 | "value": "myPassword", 47 | "type": "string" 48 | }, 49 | { 50 | "key": "username", 51 | "value": "myUser", 52 | "type": "string" 53 | } 54 | ] 55 | }, 56 | "method": "GET", 57 | "header": [], 58 | "url": { 59 | "raw": "https://api.io/users?age=45&name=Jhon&review=true&number=23.56", 60 | "protocol": "https", 61 | "host": [ 62 | "api", 63 | "io" 64 | ], 65 | "path": [ 66 | "users" 67 | ], 68 | "query": [ 69 | { 70 | "key": "age", 71 | "value": "45", 72 | "description": "Filter by age" 73 | }, 74 | { 75 | "key": "name", 76 | "value": "Jhon", 77 | "description": "Filter by name" 78 | }, 79 | { 80 | "key": "review", 81 | "value": "true", 82 | "description": "Indicate if should be reviewed or not" 83 | }, 84 | { 85 | "key": "number", 86 | "value": "23.56", 87 | "description": "This is a number" 88 | } 89 | ] 90 | }, 91 | "description": "Obtain a list of users that fullfill the conditions of the filters" 92 | }, 93 | "response": [] 94 | } 95 | ], 96 | "auth": { 97 | "type": "bearer", 98 | "bearer": [ 99 | { 100 | "key": "token", 101 | "value": "YUIHUILOIJOJOJ", 102 | "type": "string" 103 | } 104 | ] 105 | }, 106 | "event": [ 107 | { 108 | "listen": "prerequest", 109 | "script": { 110 | "type": "text/javascript", 111 | "exec": [ 112 | "" 113 | ] 114 | } 115 | }, 116 | { 117 | "listen": "test", 118 | "script": { 119 | "type": "text/javascript", 120 | "exec": [ 121 | "" 122 | ] 123 | } 124 | } 125 | ] 126 | } -------------------------------------------------------------------------------- /test/resources/input/v21/AuthRequest.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "4d9c5d4f-0fe4-49a5-9760-4381d965b199", 4 | "name": "AuthRequest", 5 | "description": "Collection to test authorization to request level", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User Copy", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": { 24 | "raw": "https://api.io/users", 25 | "protocol": "https", 26 | "host": [ 27 | "api", 28 | "io" 29 | ], 30 | "path": [ 31 | "users" 32 | ] 33 | }, 34 | "description": "Create a new user into your amazing API" 35 | }, 36 | "response": [] 37 | }, 38 | { 39 | "name": "Get list of users", 40 | "request": { 41 | "auth": { 42 | "type": "basic", 43 | "basic": [ 44 | { 45 | "key": "password", 46 | "value": "myPassword", 47 | "type": "string" 48 | }, 49 | { 50 | "key": "username", 51 | "value": "myUser", 52 | "type": "string" 53 | } 54 | ] 55 | }, 56 | "method": "GET", 57 | "header": [], 58 | "url": { 59 | "raw": "https://api.io/users?age=45&name=Jhon&review=true&number=23.56", 60 | "protocol": "https", 61 | "host": [ 62 | "api", 63 | "io" 64 | ], 65 | "path": [ 66 | "users" 67 | ], 68 | "query": [ 69 | { 70 | "key": "age", 71 | "value": "45", 72 | "description": "Filter by age" 73 | }, 74 | { 75 | "key": "name", 76 | "value": "Jhon", 77 | "description": "Filter by name" 78 | }, 79 | { 80 | "key": "review", 81 | "value": "true", 82 | "description": "Indicate if should be reviewed or not" 83 | }, 84 | { 85 | "key": "number", 86 | "value": "23.56", 87 | "description": "This is a number" 88 | } 89 | ] 90 | }, 91 | "description": "Obtain a list of users that fullfill the conditions of the filters" 92 | }, 93 | "response": [] 94 | } 95 | ], 96 | "event": [ 97 | { 98 | "listen": "prerequest", 99 | "script": { 100 | "type": "text/javascript", 101 | "exec": [ 102 | "" 103 | ] 104 | } 105 | }, 106 | { 107 | "listen": "test", 108 | "script": { 109 | "type": "text/javascript", 110 | "exec": [ 111 | "" 112 | ] 113 | } 114 | } 115 | ] 116 | } -------------------------------------------------------------------------------- /test/resources/input/v21/BasepathVar.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "033eef66-b948-4d5f-8c7b-a38fea9932f4", 4 | "name": "Basepath Var", 5 | "description": "Just a simple collection for test", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": { 24 | "raw": "{{base_url}}/users", 25 | "host": [ 26 | "{{base_url}}" 27 | ], 28 | "path": [ 29 | "users" 30 | ] 31 | }, 32 | "description": "Create a new user into your amazing API" 33 | }, 34 | "response": [] 35 | }, 36 | { 37 | "name": "Post empty raw", 38 | "request": { 39 | "method": "POST", 40 | "header": [], 41 | "body": { 42 | "mode": "raw", 43 | "raw": "", 44 | "options": { 45 | "raw": { 46 | "language": "json" 47 | } 48 | } 49 | }, 50 | "url": { 51 | "raw": "{{base_url}}/raw", 52 | "host": [ 53 | "{{base_url}}" 54 | ], 55 | "path": [ 56 | "raw" 57 | ] 58 | }, 59 | "description": "Create a new user into your amazing API" 60 | }, 61 | "response": [] 62 | } 63 | ], 64 | "event": [ 65 | { 66 | "listen": "prerequest", 67 | "script": { 68 | "type": "text/javascript", 69 | "exec": [ 70 | "" 71 | ] 72 | } 73 | }, 74 | { 75 | "listen": "test", 76 | "script": { 77 | "type": "text/javascript", 78 | "exec": [ 79 | "" 80 | ] 81 | } 82 | } 83 | ], 84 | "variable": [ 85 | { 86 | "key": "version", 87 | "value": "2.3.0" 88 | } 89 | ] 90 | } -------------------------------------------------------------------------------- /test/resources/input/v21/DeleteOperation.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "469344e4-4c85-45fe-b0a6-246575a018bc", 4 | "name": "Delete Operation", 5 | "description": "Mi super test collection from postman", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Delete all users", 11 | "request": { 12 | "method": "DELETE", 13 | "header": [], 14 | "url": { 15 | "raw": "https://api.io/users", 16 | "protocol": "https", 17 | "host": [ 18 | "api", 19 | "io" 20 | ], 21 | "path": [ 22 | "users" 23 | ] 24 | }, 25 | "description": "Delete all the existing users" 26 | }, 27 | "response": [] 28 | } 29 | ], 30 | "event": [ 31 | { 32 | "listen": "prerequest", 33 | "script": { 34 | "id": "9f8baaad-642e-48c6-b5d3-6ec59d2df6b1", 35 | "type": "text/javascript", 36 | "exec": [ 37 | "" 38 | ] 39 | } 40 | }, 41 | { 42 | "listen": "test", 43 | "script": { 44 | "id": "61df081f-afb8-4e8a-8a32-66db8b22f887", 45 | "type": "text/javascript", 46 | "exec": [ 47 | "" 48 | ] 49 | } 50 | } 51 | ], 52 | "variable": [ 53 | { 54 | "id": "b8ff9254-81e3-432f-9e5a-aea92cf34d7c", 55 | "key": "version", 56 | "value": "1.1.0" 57 | } 58 | ], 59 | "protocolProfileBehavior": {} 60 | } -------------------------------------------------------------------------------- /test/resources/input/v21/DepthPathParams.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "c2a620d9-979e-4f39-b6bc-22282ce4b21a", 4 | "name": "Large Path Params", 5 | "description": "Collection to test path parameters", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Get one users info", 11 | "request": { 12 | "method": "GET", 13 | "header": [], 14 | "url": { 15 | "raw": "https://api.io/dev/users/{{user_id}}", 16 | "protocol": "https", 17 | "host": [ 18 | "api", 19 | "io" 20 | ], 21 | "path": [ 22 | "dev", 23 | "users", 24 | "{{user_id}}" 25 | ] 26 | }, 27 | "description": "Obtain a list of users that fullfill the conditions of the filters" 28 | }, 29 | "response": [] 30 | }, 31 | { 32 | "name": "Get descriptions of a user", 33 | "request": { 34 | "method": "GET", 35 | "header": [], 36 | "url": { 37 | "raw": "https://api.io/dev/user/{{user_id}}/desc/", 38 | "protocol": "https", 39 | "host": [ 40 | "api", 41 | "io" 42 | ], 43 | "path": [ 44 | "dev", 45 | "user", 46 | "{{user_id}}", 47 | "desc", 48 | "" 49 | ] 50 | }, 51 | "description": "Obtain a list of users descriptions\n\n# postman-to-openapi\n\n| object | name | description | required | type | example |\n|--------|----------|--------------------------------|----------|--------|-----------|\n| path | user_id | This is just a user identifier | true | number | 476587598 |" 52 | }, 53 | "response": [] 54 | }, 55 | { 56 | "name": "Get a description from an user", 57 | "request": { 58 | "method": "GET", 59 | "header": [], 60 | "url": { 61 | "raw": "https://api.io/dev/user/{{user_id}}/desc/{{desc_id}}", 62 | "protocol": "https", 63 | "host": [ 64 | "api", 65 | "io" 66 | ], 67 | "path": [ 68 | "dev", 69 | "user", 70 | "{{user_id}}", 71 | "desc", 72 | "{{desc_id}}" 73 | ] 74 | }, 75 | "description": "Obtain a list of users descriptions\n\n# postman-to-openapi\n\n| object | name | description | required | type | example |\n|--------|----------|--------------------------------|----------|--------|-----------|\n| path | user_id | This is just a user identifier | true | number | 476587598 |\n| path | desc_id | Description id | true | string | ALMT |" 76 | }, 77 | "response": [] 78 | } 79 | ], 80 | "event": [ 81 | { 82 | "listen": "prerequest", 83 | "script": { 84 | "id": "3d4c9432-87d0-46d1-8e0a-7bf78b95838f", 85 | "type": "text/javascript", 86 | "exec": [ 87 | "" 88 | ] 89 | } 90 | }, 91 | { 92 | "listen": "test", 93 | "script": { 94 | "id": "bfa95668-f3ba-423f-93d3-152fbba765af", 95 | "type": "text/javascript", 96 | "exec": [ 97 | "" 98 | ] 99 | } 100 | } 101 | ], 102 | "protocolProfileBehavior": {} 103 | } -------------------------------------------------------------------------------- /test/resources/input/v21/DisabledParams.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "43c37e23-7cc8-4e6b-acf1-46396b4f4bfd", 4 | "name": "DisabledParams", 5 | "description": "Test API for disabled parameters feature", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", 7 | "_exporter_id": "64956" 8 | }, 9 | "item": [ 10 | { 11 | "name": "Get list of users", 12 | "request": { 13 | "method": "GET", 14 | "header": [ 15 | { 16 | "key": "X-My-Header", 17 | "value": "hudjilksns78jsijns090", 18 | "description": "Custom header [required]", 19 | "type": "text" 20 | }, 21 | { 22 | "key": "X-My-Header", 23 | "value": "1234567890", 24 | "description": "Custom header disabled [required]", 25 | "type": "text", 26 | "disabled": true 27 | }, 28 | { 29 | "key": "X-Other", 30 | "value": "other", 31 | "description": "Another header [REQUIRED]", 32 | "type": "text" 33 | }, 34 | { 35 | "key": "No-description", 36 | "value": "header without description", 37 | "type": "text" 38 | }, 39 | { 40 | "key": "No-value", 41 | "value": "", 42 | "description": "header without value", 43 | "type": "text" 44 | }, 45 | { 46 | "key": "X-Disabled-Header", 47 | "value": "QWERTY", 48 | "description": "Disabled parameter", 49 | "type": "text", 50 | "disabled": true 51 | } 52 | ], 53 | "url": { 54 | "raw": "https://api.io/:section/users?name=Jhon&review=true", 55 | "protocol": "https", 56 | "host": [ 57 | "api", 58 | "io" 59 | ], 60 | "path": [ 61 | ":section", 62 | "users" 63 | ], 64 | "query": [ 65 | { 66 | "key": "age", 67 | "value": "45", 68 | "description": "Disabled param", 69 | "disabled": true 70 | }, 71 | { 72 | "key": "name", 73 | "value": "Jhon", 74 | "description": "Filter by name" 75 | }, 76 | { 77 | "key": "review", 78 | "value": "true", 79 | "description": "Indicate if should be reviewed or not" 80 | }, 81 | { 82 | "key": "name", 83 | "value": "Mark", 84 | "description": "Disabled param duplicated", 85 | "disabled": true 86 | } 87 | ], 88 | "variable": [ 89 | { 90 | "key": "section", 91 | "value": "spain", 92 | "description": "A path parameter" 93 | } 94 | ] 95 | }, 96 | "description": "Obtain a list of users that fullfill the conditions of the filters" 97 | }, 98 | "response": [] 99 | } 100 | ], 101 | "event": [ 102 | { 103 | "listen": "prerequest", 104 | "script": { 105 | "type": "text/javascript", 106 | "exec": [ 107 | "" 108 | ] 109 | } 110 | }, 111 | { 112 | "listen": "test", 113 | "script": { 114 | "type": "text/javascript", 115 | "exec": [ 116 | "" 117 | ] 118 | } 119 | } 120 | ] 121 | } -------------------------------------------------------------------------------- /test/resources/input/v21/EmptyUrl.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "e223ab3f-2683-4759-9e41-8167a7caaf99", 4 | "name": "Simple Post", 5 | "description": "Just a simple collection for test", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": { 24 | "raw": "https://api.io/users", 25 | "protocol": "https", 26 | "host": [ 27 | "api", 28 | "io" 29 | ], 30 | "path": [ 31 | "users" 32 | ] 33 | }, 34 | "description": "Create a new user into your amazing API" 35 | }, 36 | "response": [] 37 | }, 38 | { 39 | "name": "Post empty raw", 40 | "request": { 41 | "method": "POST", 42 | "header": [], 43 | "body": { 44 | "mode": "raw", 45 | "raw": "", 46 | "options": { 47 | "raw": { 48 | "language": "json" 49 | } 50 | } 51 | }, 52 | "url": { 53 | "raw": "" 54 | }, 55 | "description": "Create a new user into your amazing API" 56 | }, 57 | "response": [] 58 | } 59 | ], 60 | "variable": [ 61 | { 62 | "key": "version", 63 | "value": "2.3.0" 64 | } 65 | ] 66 | } -------------------------------------------------------------------------------- /test/resources/input/v21/ExternalDocs.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "3c770257-049e-41c1-bc50-7b08e0ee4048", 4 | "name": "External Docs", 5 | "description": "Just a simple collection for test", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": { 24 | "raw": "https://api.io/users", 25 | "protocol": "https", 26 | "host": [ 27 | "api", 28 | "io" 29 | ], 30 | "path": [ 31 | "users" 32 | ] 33 | }, 34 | "description": "Create a new user into your amazing API" 35 | }, 36 | "response": [] 37 | } 38 | ], 39 | "event": [ 40 | { 41 | "listen": "prerequest", 42 | "script": { 43 | "id": "990c4de2-f783-45af-9b58-55f044b43e17", 44 | "type": "text/javascript", 45 | "exec": [ 46 | "" 47 | ] 48 | } 49 | }, 50 | { 51 | "listen": "test", 52 | "script": { 53 | "id": "6314f41c-4c4e-4559-9692-4f0d71ce5c98", 54 | "type": "text/javascript", 55 | "exec": [ 56 | "" 57 | ] 58 | } 59 | } 60 | ], 61 | "variable": [ 62 | { 63 | "id": "580b417e-39f3-4201-8292-0aae05b367c4", 64 | "key": "version", 65 | "value": "2.3.0" 66 | }, 67 | { 68 | "id": "d96bc914-09bd-4e8e-b6ab-deb6313e2d32", 69 | "key": "externalDocs.url", 70 | "value": "https://docs.example.com" 71 | }, 72 | { 73 | "id": "c0d4152f-3d25-4d48-b9f2-251f341868e4", 74 | "key": "externalDocs.description", 75 | "value": "Find more info here" 76 | } 77 | ], 78 | "protocolProfileBehavior": {} 79 | } -------------------------------------------------------------------------------- /test/resources/input/v21/FormData.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "66fd929e-c84f-4bc5-970a-60231fe16f5b", 4 | "name": "Form Data", 5 | "description": "Just a collection with a form data post for test", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Register New User", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "formdata", 16 | "formdata": [ 17 | { 18 | "key": "name", 19 | "value": "New User", 20 | "description": "full name of the user (accepts spaces) [required]", 21 | "type": "text" 22 | }, 23 | { 24 | "key": "email", 25 | "value": "newuser@example.com", 26 | "description": "email of the user (for notifications and login) [required]", 27 | "type": "text" 28 | }, 29 | { 30 | "key": "password", 31 | "value": "pasword123", 32 | "type": "text" 33 | }, 34 | { 35 | "key": "profileImage", 36 | "description": "User avatar", 37 | "contentType": "application/octet-stream", 38 | "type": "file", 39 | "src": [] 40 | } 41 | ] 42 | }, 43 | "url": { 44 | "raw": "https://api.io/register", 45 | "protocol": "https", 46 | "host": [ 47 | "api", 48 | "io" 49 | ], 50 | "path": [ 51 | "register" 52 | ] 53 | } 54 | }, 55 | "response": [] 56 | } 57 | ] 58 | } 59 | -------------------------------------------------------------------------------- /test/resources/input/v21/FormUrlencoded.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "c7890cb4-aa39-4569-9701-a9d6f4abc750", 4 | "name": "Form Url Encoded", 5 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 6 | }, 7 | "item": [ 8 | { 9 | "name": "Register New User", 10 | "request": { 11 | "method": "POST", 12 | "header": [], 13 | "body": { 14 | "mode": "urlencoded", 15 | "urlencoded": [ 16 | { 17 | "key": "name", 18 | "value": "New User", 19 | "description": "full name of the user (accepts spaces) [required]", 20 | "type": "text" 21 | }, 22 | { 23 | "key": "email", 24 | "value": "newuser@example.com", 25 | "description": "email of the user (for notifications and login) [required]", 26 | "type": "text" 27 | }, 28 | { 29 | "key": "password", 30 | "value": "pasword123", 31 | "description": "password (to be used for logging in) [required]", 32 | "type": "text" 33 | } 34 | ] 35 | }, 36 | "url": { 37 | "raw": "https://api.io/register", 38 | "protocol": "https", 39 | "host": [ 40 | "api", 41 | "io" 42 | ], 43 | "path": [ 44 | "register" 45 | ] 46 | } 47 | }, 48 | "response": [] 49 | } 50 | ] 51 | } -------------------------------------------------------------------------------- /test/resources/input/v21/GetMethods.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "e0553220-9270-4359-aa97-b16161df07ad", 4 | "name": "Get Methods", 5 | "description": "API to manage GET methods", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Get list of users", 11 | "request": { 12 | "method": "GET", 13 | "header": [], 14 | "url": { 15 | "raw": "https://api.io/users?age=45&name=Jhon&review=true&number=23.56&required=my value&number1=0.4565876&number2=123.45&fake-number=1.23.45&date=2022-06-23T10:00:00.000+01:00", 16 | "protocol": "https", 17 | "host": [ 18 | "api", 19 | "io" 20 | ], 21 | "path": [ 22 | "users" 23 | ], 24 | "query": [ 25 | { 26 | "key": "age", 27 | "value": "45", 28 | "description": "Filter by age [required]" 29 | }, 30 | { 31 | "key": "name", 32 | "value": "Jhon", 33 | "description": "Filter by name [REQUIRED]" 34 | }, 35 | { 36 | "key": "review", 37 | "value": "true", 38 | "description": "Indicate if should be reviewed or not" 39 | }, 40 | { 41 | "key": "number", 42 | "value": "23.56", 43 | "description": "This is a number" 44 | }, 45 | { 46 | "key": "required", 47 | "value": "my value", 48 | "description": "[required] mandatory paraemeter" 49 | }, 50 | { 51 | "key": "number1", 52 | "value": "0.4565876", 53 | "description": "Should be parsed as number" 54 | }, 55 | { 56 | "key": "number2", 57 | "value": "123.45", 58 | "description": "Should be parsed as number" 59 | }, 60 | { 61 | "key": "fake-number", 62 | "value": "1.23.45", 63 | "description": "Should be parsed as string" 64 | }, 65 | { 66 | "key": "date", 67 | "value": "2022-06-23T10:00:00.000+01:00", 68 | "description": "Should be parsed as string" 69 | } 70 | ] 71 | }, 72 | "description": "Obtain a list of users that fullfill the conditions of the filters" 73 | }, 74 | "response": [] 75 | } 76 | ], 77 | "event": [ 78 | { 79 | "listen": "prerequest", 80 | "script": { 81 | "id": "5ca076cb-bc5f-4366-9a0e-90af3f9a8027", 82 | "type": "text/javascript", 83 | "exec": [ 84 | "" 85 | ] 86 | } 87 | }, 88 | { 89 | "listen": "test", 90 | "script": { 91 | "id": "40709de0-c637-46fb-a742-ba8bb1659db4", 92 | "type": "text/javascript", 93 | "exec": [ 94 | "" 95 | ] 96 | } 97 | } 98 | ], 99 | "protocolProfileBehavior": {} 100 | } -------------------------------------------------------------------------------- /test/resources/input/v21/LicenseContact.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "9f1fe3cc-9229-471a-96b4-6bca41bd7ab0", 4 | "name": "License and Contact", 5 | "description": "Collection to test license as variable", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Get list of users", 11 | "request": { 12 | "method": "GET", 13 | "header": [], 14 | "url": { 15 | "raw": "https://api.io/users?age=45&name=Jhon&review=true&number=23.56", 16 | "protocol": "https", 17 | "host": [ 18 | "api", 19 | "io" 20 | ], 21 | "path": [ 22 | "users" 23 | ], 24 | "query": [ 25 | { 26 | "key": "age", 27 | "value": "45", 28 | "description": "Filter by age" 29 | }, 30 | { 31 | "key": "name", 32 | "value": "Jhon", 33 | "description": "Filter by name" 34 | }, 35 | { 36 | "key": "review", 37 | "value": "true", 38 | "description": "Indicate if should be reviewed or not" 39 | }, 40 | { 41 | "key": "number", 42 | "value": "23.56", 43 | "description": "This is a number" 44 | } 45 | ] 46 | }, 47 | "description": "Obtain a list of users that fullfill the conditions of the filters" 48 | }, 49 | "response": [] 50 | } 51 | ], 52 | "event": [ 53 | { 54 | "listen": "prerequest", 55 | "script": { 56 | "id": "2973e583-323c-418e-a553-096171309624", 57 | "type": "text/javascript", 58 | "exec": [ 59 | "" 60 | ] 61 | } 62 | }, 63 | { 64 | "listen": "test", 65 | "script": { 66 | "id": "c0dc618b-5ca4-43db-8b6e-ac29eff17880", 67 | "type": "text/javascript", 68 | "exec": [ 69 | "" 70 | ] 71 | } 72 | } 73 | ], 74 | "variable": [ 75 | { 76 | "id": "b573c8e4-6a13-4d0e-8c3b-19536462f36c", 77 | "key": "license.name", 78 | "value": "Apache 2.0" 79 | }, 80 | { 81 | "id": "b1aecf73-5ff1-4cea-b447-80fe28da62c1", 82 | "key": "license.url", 83 | "value": "https://www.apache.org/licenses/LICENSE-2.0.html" 84 | }, 85 | { 86 | "id": "35641083-7bd6-4c98-b2a8-4b45da0cdeb9", 87 | "key": "contact.name", 88 | "value": "API Support" 89 | }, 90 | { 91 | "id": "7762d7a2-78f9-46eb-bf99-2a9519f35a79", 92 | "key": "contact.url", 93 | "value": "http://www.example.com/support" 94 | }, 95 | { 96 | "id": "77c31f06-45ae-40ef-9734-1b03b7bd21fc", 97 | "key": "contact.email", 98 | "value": "support@example.com" 99 | } 100 | ], 101 | "protocolProfileBehavior": {} 102 | } -------------------------------------------------------------------------------- /test/resources/input/v21/NoPath.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "074ac938-087e-4762-8a33-feadabfa1145", 4 | "name": "No Path", 5 | "description": "API to manage GET methods", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Get list of users", 11 | "request": { 12 | "method": "GET", 13 | "header": [], 14 | "url": { 15 | "raw": "https://api.io?age=45&name=Jhon&review=true&number=23.56&required=my value", 16 | "protocol": "https", 17 | "host": [ 18 | "api", 19 | "io" 20 | ], 21 | "query": [ 22 | { 23 | "key": "age", 24 | "value": "45", 25 | "description": "Filter by age [required]" 26 | }, 27 | { 28 | "key": "name", 29 | "value": "Jhon", 30 | "description": "Filter by name [REQUIRED]" 31 | }, 32 | { 33 | "key": "review", 34 | "value": "true", 35 | "description": "Indicate if should be reviewed or not" 36 | }, 37 | { 38 | "key": "number", 39 | "value": "23.56", 40 | "description": "This is a number" 41 | }, 42 | { 43 | "key": "required", 44 | "value": "my value", 45 | "description": "[required] mandatory paraemeter" 46 | } 47 | ] 48 | }, 49 | "description": "Obtain a list of users that fullfill the conditions of the filters" 50 | }, 51 | "response": [] 52 | } 53 | ], 54 | "event": [ 55 | { 56 | "listen": "prerequest", 57 | "script": { 58 | "id": "e5a590b1-117c-4050-9541-926b7188ebe0", 59 | "type": "text/javascript", 60 | "exec": [ 61 | "" 62 | ] 63 | } 64 | }, 65 | { 66 | "listen": "test", 67 | "script": { 68 | "id": "6fb7b705-a3fc-45e0-8a80-3f2b5ce4bf9f", 69 | "type": "text/javascript", 70 | "exec": [ 71 | "" 72 | ] 73 | } 74 | } 75 | ], 76 | "protocolProfileBehavior": {} 77 | } -------------------------------------------------------------------------------- /test/resources/input/v21/NoVersion.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "3ad7e1b4-f3a1-4a8f-8bd0-56ff18f53339", 4 | "name": "No Version Collection", 5 | "description": "This collection don't have a version as variable", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": { 24 | "raw": "https://api.io/users", 25 | "protocol": "https", 26 | "host": [ 27 | "api", 28 | "io" 29 | ], 30 | "path": [ 31 | "users" 32 | ] 33 | }, 34 | "description": "Create a new user into your amazing API" 35 | }, 36 | "response": [] 37 | } 38 | ], 39 | "variable": [], 40 | "protocolProfileBehavior": {} 41 | } -------------------------------------------------------------------------------- /test/resources/input/v21/OperationIds.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "030b673d-ddb2-4217-914c-46890cf112cc", 4 | "name": "OperationIds", 5 | "description": "Mi super test collection from postman", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", 7 | "_exporter_id": "64956" 8 | }, 9 | "item": [ 10 | { 11 | "name": "Create new User", 12 | "request": { 13 | "method": "POST", 14 | "header": [], 15 | "body": { 16 | "mode": "raw", 17 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 18 | "options": { 19 | "raw": { 20 | "language": "json" 21 | } 22 | } 23 | }, 24 | "url": { 25 | "raw": "https://api.io/users", 26 | "protocol": "https", 27 | "host": [ 28 | "api", 29 | "io" 30 | ], 31 | "path": [ 32 | "users" 33 | ] 34 | }, 35 | "description": "Create a new user into your amazing API" 36 | }, 37 | "response": [] 38 | }, 39 | { 40 | "name": "Create a post [createPost]", 41 | "request": { 42 | "method": "POST", 43 | "header": [], 44 | "body": { 45 | "mode": "file", 46 | "file": {} 47 | }, 48 | "url": { 49 | "raw": "https://api.io/posts", 50 | "protocol": "https", 51 | "host": [ 52 | "api", 53 | "io" 54 | ], 55 | "path": [ 56 | "posts" 57 | ] 58 | } 59 | }, 60 | "response": [] 61 | }, 62 | { 63 | "name": "Create a note [createNote]", 64 | "request": { 65 | "method": "POST", 66 | "header": [], 67 | "body": { 68 | "mode": "raw", 69 | "raw": "This is an example Note", 70 | "options": { 71 | "raw": { 72 | "language": "text" 73 | } 74 | } 75 | }, 76 | "url": { 77 | "raw": "https://api.io/note", 78 | "protocol": "https", 79 | "host": [ 80 | "api", 81 | "io" 82 | ], 83 | "path": [ 84 | "note" 85 | ] 86 | }, 87 | "description": "Just an example of text raw body" 88 | }, 89 | "response": [] 90 | } 91 | ], 92 | "event": [ 93 | { 94 | "listen": "prerequest", 95 | "script": { 96 | "type": "text/javascript", 97 | "exec": [ 98 | "" 99 | ] 100 | } 101 | }, 102 | { 103 | "listen": "test", 104 | "script": { 105 | "type": "text/javascript", 106 | "exec": [ 107 | "" 108 | ] 109 | } 110 | } 111 | ], 112 | "variable": [ 113 | { 114 | "key": "version", 115 | "value": "1.1.0" 116 | } 117 | ] 118 | } -------------------------------------------------------------------------------- /test/resources/input/v21/PostmantoOpenAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "2a45baa5-352f-4831-8483-1a0fcbc7da37", 4 | "name": "Postman to OpenAPI", 5 | "description": "Mi super test collection from postman", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": { 24 | "raw": "https://api.io/users", 25 | "protocol": "https", 26 | "host": [ 27 | "api", 28 | "io" 29 | ], 30 | "path": [ 31 | "users" 32 | ] 33 | }, 34 | "description": "Create a new user into your amazing API" 35 | }, 36 | "response": [] 37 | }, 38 | { 39 | "name": "Create a post", 40 | "request": { 41 | "method": "POST", 42 | "header": [], 43 | "body": { 44 | "mode": "file", 45 | "file": {}, 46 | "options": { 47 | "raw": { 48 | "language": "text" 49 | } 50 | } 51 | }, 52 | "url": { 53 | "raw": "https://api.io/posts", 54 | "protocol": "https", 55 | "host": [ 56 | "api", 57 | "io" 58 | ], 59 | "path": [ 60 | "posts" 61 | ] 62 | } 63 | }, 64 | "response": [] 65 | }, 66 | { 67 | "name": "Create a note", 68 | "request": { 69 | "method": "POST", 70 | "header": [], 71 | "body": { 72 | "mode": "raw", 73 | "raw": "This is an example Note", 74 | "options": { 75 | "raw": { 76 | "language": "text" 77 | } 78 | } 79 | }, 80 | "url": { 81 | "raw": "https://api.io/note", 82 | "protocol": "https", 83 | "host": [ 84 | "api", 85 | "io" 86 | ], 87 | "path": [ 88 | "note" 89 | ] 90 | }, 91 | "description": "Just an example of text raw body" 92 | }, 93 | "response": [] 94 | }, 95 | { 96 | "name": "No url request", 97 | "request": { 98 | "method": "GET", 99 | "header": [] 100 | }, 101 | "response": [] 102 | } 103 | ], 104 | "event": [ 105 | { 106 | "listen": "prerequest", 107 | "script": { 108 | "id": "ef248fcc-2944-4cba-837f-680b10a45b30", 109 | "type": "text/javascript", 110 | "exec": [ 111 | "" 112 | ] 113 | } 114 | }, 115 | { 116 | "listen": "test", 117 | "script": { 118 | "id": "8e7453aa-5712-4a90-bc32-965c7d47906a", 119 | "type": "text/javascript", 120 | "exec": [ 121 | "" 122 | ] 123 | } 124 | } 125 | ], 126 | "variable": [ 127 | { 128 | "id": "d04439bd-c604-4758-bde2-3c873140f38c", 129 | "key": "version", 130 | "value": "1.1.0" 131 | } 132 | ], 133 | "protocolProfileBehavior": {} 134 | } -------------------------------------------------------------------------------- /test/resources/input/v21/RawBody.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "b9a3a079-e781-4cb5-9ae6-009640952df5", 4 | "name": "Raw Body", 5 | "description": "Mi super test collection from postman", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Test Raw Body", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "testesttestest", 17 | "options": { 18 | "raw": { 19 | "language": "text" 20 | } 21 | } 22 | }, 23 | "url": { 24 | "raw": "https://api.io/test", 25 | "protocol": "https", 26 | "host": [ 27 | "api", 28 | "io" 29 | ], 30 | "path": [ 31 | "test" 32 | ] 33 | }, 34 | "description": "Test Raw Body" 35 | }, 36 | "response": [] 37 | } 38 | ], 39 | "event": [ 40 | { 41 | "listen": "prerequest", 42 | "script": { 43 | "type": "text/javascript", 44 | "exec": [ 45 | "" 46 | ] 47 | } 48 | }, 49 | { 50 | "listen": "test", 51 | "script": { 52 | "type": "text/javascript", 53 | "exec": [ 54 | "" 55 | ] 56 | } 57 | } 58 | ] 59 | } -------------------------------------------------------------------------------- /test/resources/input/v21/SimplePost.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "e223ab3f-2683-4759-9e41-8167a7caaf99", 4 | "name": "Simple Post", 5 | "description": "Just a simple collection for test", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": { 24 | "raw": "https://api.io/users", 25 | "protocol": "https", 26 | "host": [ 27 | "api", 28 | "io" 29 | ], 30 | "path": [ 31 | "users" 32 | ] 33 | }, 34 | "description": "Create a new user into your amazing API" 35 | }, 36 | "response": [] 37 | }, 38 | { 39 | "name": "Post empty raw", 40 | "request": { 41 | "method": "POST", 42 | "header": [], 43 | "body": { 44 | "mode": "raw", 45 | "raw": "", 46 | "options": { 47 | "raw": { 48 | "language": "json" 49 | } 50 | } 51 | }, 52 | "url": { 53 | "raw": "https://api.io/raw", 54 | "protocol": "https", 55 | "host": [ 56 | "api", 57 | "io" 58 | ], 59 | "path": [ 60 | "raw" 61 | ] 62 | }, 63 | "description": "Create a new user into your amazing API" 64 | }, 65 | "response": [] 66 | } 67 | ], 68 | "variable": [ 69 | { 70 | "key": "version", 71 | "value": "2.3.0" 72 | } 73 | ] 74 | } -------------------------------------------------------------------------------- /test/resources/input/v21/UrlWithPort.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "b1be28f8-d097-4024-b88a-4bbb5c9cde3d", 4 | "name": "Url with Port", 5 | "description": "Just a simple collection for test", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": { 24 | "raw": "https://api.io:453/users", 25 | "protocol": "https", 26 | "host": [ 27 | "api", 28 | "io" 29 | ], 30 | "port": "453", 31 | "path": [ 32 | "users" 33 | ] 34 | }, 35 | "description": "Create a new user into your amazing API" 36 | }, 37 | "response": [] 38 | } 39 | ], 40 | "variable": [ 41 | { 42 | "id": "a1b68638-d65e-4ee8-9a91-4d5749e9c2f2", 43 | "key": "version", 44 | "value": "2.3.0" 45 | } 46 | ], 47 | "protocolProfileBehavior": {} 48 | } -------------------------------------------------------------------------------- /test/resources/input/v21/XLogo.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "e223ab3f-2683-4759-9e41-8167a7caaf99", 4 | "name": "Simple Post", 5 | "description": "Just a simple collection for test", 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 7 | }, 8 | "item": [ 9 | { 10 | "name": "Create new User", 11 | "request": { 12 | "method": "POST", 13 | "header": [], 14 | "body": { 15 | "mode": "raw", 16 | "raw": "{\n \"example\": \"field\",\n \"other\": {\n \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}", 17 | "options": { 18 | "raw": { 19 | "language": "json" 20 | } 21 | } 22 | }, 23 | "url": { 24 | "raw": "https://api.io/users", 25 | "protocol": "https", 26 | "host": [ 27 | "api", 28 | "io" 29 | ], 30 | "path": [ 31 | "users" 32 | ] 33 | }, 34 | "description": "Create a new user into your amazing API" 35 | }, 36 | "response": [] 37 | }, 38 | { 39 | "name": "Post empty raw", 40 | "request": { 41 | "method": "POST", 42 | "header": [], 43 | "body": { 44 | "mode": "raw", 45 | "raw": "", 46 | "options": { 47 | "raw": { 48 | "language": "json" 49 | } 50 | } 51 | }, 52 | "url": { 53 | "raw": "https://api.io/raw", 54 | "protocol": "https", 55 | "host": [ 56 | "api", 57 | "io" 58 | ], 59 | "path": [ 60 | "raw" 61 | ] 62 | }, 63 | "description": "Create a new user into your amazing API" 64 | }, 65 | "response": [] 66 | } 67 | ], 68 | "event": [ 69 | { 70 | "listen": "prerequest", 71 | "script": { 72 | "type": "text/javascript", 73 | "exec": [ 74 | "" 75 | ] 76 | } 77 | }, 78 | { 79 | "listen": "test", 80 | "script": { 81 | "type": "text/javascript", 82 | "exec": [ 83 | "" 84 | ] 85 | } 86 | } 87 | ], 88 | "variable": [ 89 | { 90 | "key": "version", 91 | "value": "2.3.0" 92 | }, 93 | { 94 | "key": "x-logo.urlVar", 95 | "value": "https://github.com/joolfe/mylogo.png" 96 | }, 97 | { 98 | "key": "x-logo.backgroundColorVar", 99 | "value": "#000FFF" 100 | }, 101 | { 102 | "key": "x-logo.altTextVar", 103 | "value": "Othert text for logo" 104 | }, 105 | { 106 | "key": "x-logo.hrefVar", 107 | "value": "https://github.com/joolfe/here.html" 108 | } 109 | ] 110 | } -------------------------------------------------------------------------------- /test/resources/options/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "title": "Options title", 4 | "version": "6.0.7-beta", 5 | "description": "Description from options", 6 | "termsOfService": "http://tos.myweb.com" 7 | } 8 | } -------------------------------------------------------------------------------- /test/resources/output/AuthBasic.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: AuthBasic 4 | description: Collection to test authorization global 5 | version: 1.0.0 6 | servers: 7 | - url: https://api.io 8 | components: 9 | securitySchemes: 10 | basicAuth: 11 | type: http 12 | scheme: basic 13 | security: 14 | - basicAuth: [] 15 | paths: 16 | /users: 17 | post: 18 | tags: 19 | - default 20 | summary: Create new User Copy 21 | description: Create a new user into your amazing API 22 | requestBody: 23 | content: 24 | application/json: 25 | schema: 26 | type: object 27 | example: 28 | example: field 29 | other: 30 | data1: 'yes' 31 | data2: 'no' 32 | responses: 33 | '200': 34 | description: Successful response 35 | content: 36 | application/json: {} 37 | get: 38 | tags: 39 | - default 40 | summary: Get list of users 41 | description: Obtain a list of users that fullfill the conditions of the filters 42 | parameters: 43 | - name: age 44 | in: query 45 | schema: 46 | type: integer 47 | description: Filter by age 48 | example: '45' 49 | - name: name 50 | in: query 51 | schema: 52 | type: string 53 | description: Filter by name 54 | example: Jhon 55 | - name: review 56 | in: query 57 | schema: 58 | type: boolean 59 | description: Indicate if should be reviewed or not 60 | example: 'true' 61 | - name: number 62 | in: query 63 | schema: 64 | type: number 65 | description: This is a number 66 | example: '23.56' 67 | responses: 68 | '200': 69 | description: Successful response 70 | content: 71 | application/json: {} 72 | -------------------------------------------------------------------------------- /test/resources/output/AuthBearer.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: AuthBearer 4 | description: Collection to test authorization global 5 | version: 1.0.0 6 | servers: 7 | - url: https://api.io 8 | components: 9 | securitySchemes: 10 | bearerAuth: 11 | type: http 12 | scheme: bearer 13 | security: 14 | - bearerAuth: [] 15 | paths: 16 | /users: 17 | post: 18 | tags: 19 | - default 20 | summary: Create new User Copy 21 | description: Create a new user into your amazing API 22 | requestBody: 23 | content: 24 | application/json: 25 | schema: 26 | type: object 27 | example: 28 | example: field 29 | other: 30 | data1: 'yes' 31 | data2: 'no' 32 | responses: 33 | '200': 34 | description: Successful response 35 | content: 36 | application/json: {} 37 | get: 38 | tags: 39 | - default 40 | summary: Get list of users 41 | description: Obtain a list of users that fullfill the conditions of the filters 42 | parameters: 43 | - name: age 44 | in: query 45 | schema: 46 | type: integer 47 | description: Filter by age 48 | example: '45' 49 | - name: name 50 | in: query 51 | schema: 52 | type: string 53 | description: Filter by name 54 | example: Jhon 55 | - name: review 56 | in: query 57 | schema: 58 | type: boolean 59 | description: Indicate if should be reviewed or not 60 | example: 'true' 61 | - name: number 62 | in: query 63 | schema: 64 | type: number 65 | description: This is a number 66 | example: '23.56' 67 | responses: 68 | '200': 69 | description: Successful response 70 | content: 71 | application/json: {} 72 | -------------------------------------------------------------------------------- /test/resources/output/AuthMultiple.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: AuthBearer 4 | description: Collection to test authorization global 5 | version: 1.0.0 6 | servers: 7 | - url: https://api.io 8 | components: 9 | securitySchemes: 10 | basicAuth: 11 | type: http 12 | scheme: basic 13 | bearerAuth: 14 | type: http 15 | scheme: bearer 16 | security: 17 | - bearerAuth: [] 18 | paths: 19 | /users: 20 | post: 21 | tags: 22 | - default 23 | summary: Create new User Copy 24 | description: Create a new user into your amazing API 25 | requestBody: 26 | content: 27 | application/json: 28 | schema: 29 | type: object 30 | example: 31 | example: field 32 | other: 33 | data1: 'yes' 34 | data2: 'no' 35 | responses: 36 | '200': 37 | description: Successful response 38 | content: 39 | application/json: {} 40 | get: 41 | tags: 42 | - default 43 | summary: Get list of users 44 | description: Obtain a list of users that fullfill the conditions of the filters 45 | security: 46 | - basicAuth: [] 47 | parameters: 48 | - name: age 49 | in: query 50 | schema: 51 | type: integer 52 | description: Filter by age 53 | example: '45' 54 | - name: name 55 | in: query 56 | schema: 57 | type: string 58 | description: Filter by name 59 | example: Jhon 60 | - name: review 61 | in: query 62 | schema: 63 | type: boolean 64 | description: Indicate if should be reviewed or not 65 | example: 'true' 66 | - name: number 67 | in: query 68 | schema: 69 | type: number 70 | description: This is a number 71 | example: '23.56' 72 | responses: 73 | '200': 74 | description: Successful response 75 | content: 76 | application/json: {} 77 | -------------------------------------------------------------------------------- /test/resources/output/AuthOptions.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: AuthBearer 4 | description: Collection to test authorization global 5 | version: 1.0.0 6 | servers: 7 | - url: https://api.io 8 | components: 9 | securitySchemes: 10 | myCustomAuth: 11 | type: http 12 | scheme: bearer 13 | bearerFormat: A resource owner JWT 14 | description: My awesome authentication using bearer 15 | myCustomAuth2: 16 | type: http 17 | scheme: basic 18 | description: My awesome authentication using user and password 19 | security: 20 | - myCustomAuth: [] 21 | - myCustomAuth2: [] 22 | paths: 23 | /users: 24 | post: 25 | tags: 26 | - default 27 | summary: Create new User Copy 28 | description: Create a new user into your amazing API 29 | requestBody: 30 | content: 31 | application/json: 32 | schema: 33 | type: object 34 | example: 35 | example: field 36 | other: 37 | data1: 'yes' 38 | data2: 'no' 39 | responses: 40 | '200': 41 | description: Successful response 42 | content: 43 | application/json: {} 44 | get: 45 | tags: 46 | - default 47 | summary: Get list of users 48 | description: Obtain a list of users that fullfill the conditions of the filters 49 | parameters: 50 | - name: age 51 | in: query 52 | schema: 53 | type: integer 54 | description: Filter by age 55 | example: '45' 56 | - name: name 57 | in: query 58 | schema: 59 | type: string 60 | description: Filter by name 61 | example: Jhon 62 | - name: review 63 | in: query 64 | schema: 65 | type: boolean 66 | description: Indicate if should be reviewed or not 67 | example: 'true' 68 | - name: number 69 | in: query 70 | schema: 71 | type: number 72 | description: This is a number 73 | example: '23.56' 74 | responses: 75 | '200': 76 | description: Successful response 77 | content: 78 | application/json: {} 79 | -------------------------------------------------------------------------------- /test/resources/output/AuthRequest.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: AuthRequest 4 | description: Collection to test authorization to request level 5 | version: 1.0.0 6 | servers: 7 | - url: https://api.io 8 | components: 9 | securitySchemes: 10 | basicAuth: 11 | type: http 12 | scheme: basic 13 | paths: 14 | /users: 15 | post: 16 | tags: 17 | - default 18 | summary: Create new User Copy 19 | description: Create a new user into your amazing API 20 | requestBody: 21 | content: 22 | application/json: 23 | schema: 24 | type: object 25 | example: 26 | example: field 27 | other: 28 | data1: 'yes' 29 | data2: 'no' 30 | responses: 31 | '200': 32 | description: Successful response 33 | content: 34 | application/json: {} 35 | get: 36 | tags: 37 | - default 38 | summary: Get list of users 39 | description: Obtain a list of users that fullfill the conditions of the filters 40 | security: 41 | - basicAuth: [] 42 | parameters: 43 | - name: age 44 | in: query 45 | schema: 46 | type: integer 47 | description: Filter by age 48 | example: '45' 49 | - name: name 50 | in: query 51 | schema: 52 | type: string 53 | description: Filter by name 54 | example: Jhon 55 | - name: review 56 | in: query 57 | schema: 58 | type: boolean 59 | description: Indicate if should be reviewed or not 60 | example: 'true' 61 | - name: number 62 | in: query 63 | schema: 64 | type: number 65 | description: This is a number 66 | example: '23.56' 67 | responses: 68 | '200': 69 | description: Successful response 70 | content: 71 | application/json: {} 72 | -------------------------------------------------------------------------------- /test/resources/output/BasepathVar.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Basepath Var 4 | description: Just a simple collection for test 5 | version: 2.3.0 6 | servers: 7 | - url: https://awesome.api.sandbox.io 8 | description: Sandbox environment server 9 | - url: https://awesome.api.io 10 | description: Production env 11 | paths: 12 | /users: 13 | post: 14 | tags: 15 | - default 16 | summary: Create new User 17 | description: Create a new user into your amazing API 18 | requestBody: 19 | content: 20 | application/json: 21 | schema: 22 | type: object 23 | example: 24 | example: field 25 | other: 26 | data1: 'yes' 27 | data2: 'no' 28 | responses: 29 | '200': 30 | description: Successful response 31 | content: 32 | application/json: {} 33 | /raw: 34 | post: 35 | tags: 36 | - default 37 | summary: Post empty raw 38 | description: Create a new user into your amazing API 39 | requestBody: 40 | content: 41 | application/json: 42 | schema: 43 | type: object 44 | example: '' 45 | responses: 46 | '200': 47 | description: Successful response 48 | content: 49 | application/json: {} 50 | -------------------------------------------------------------------------------- /test/resources/output/Basic.json: -------------------------------------------------------------------------------- 1 | { 2 | "openapi": "3.0.0", 3 | "info": { 4 | "title": "Postman to OpenAPI", 5 | "description": "Mi super test collection from postman", 6 | "version": "1.1.0" 7 | }, 8 | "servers": [ 9 | { 10 | "url": "https://api.io" 11 | } 12 | ], 13 | "paths": { 14 | "/users": { 15 | "post": { 16 | "tags": [ 17 | "default" 18 | ], 19 | "summary": "Create new User", 20 | "description": "Create a new user into your amazing API", 21 | "requestBody": { 22 | "content": { 23 | "application/json": { 24 | "schema": { 25 | "type": "object", 26 | "example": { 27 | "example": "field", 28 | "other": { 29 | "data1": "yes", 30 | "data2": "no" 31 | } 32 | } 33 | } 34 | } 35 | } 36 | }, 37 | "responses": { 38 | "200": { 39 | "description": "Successful response", 40 | "content": { 41 | "application/json": {} 42 | } 43 | } 44 | } 45 | } 46 | }, 47 | "/posts": { 48 | "post": { 49 | "tags": [ 50 | "default" 51 | ], 52 | "summary": "Create a post", 53 | "requestBody": { 54 | "content": { 55 | "text/plain": {} 56 | } 57 | }, 58 | "responses": { 59 | "200": { 60 | "description": "Successful response", 61 | "content": { 62 | "application/json": {} 63 | } 64 | } 65 | } 66 | } 67 | }, 68 | "/note": { 69 | "post": { 70 | "tags": [ 71 | "default" 72 | ], 73 | "summary": "Create a note", 74 | "description": "Just an example of text raw body", 75 | "requestBody": { 76 | "content": { 77 | "text/plain": { 78 | "schema": { 79 | "type": "string", 80 | "example": "This is an example Note" 81 | } 82 | } 83 | } 84 | }, 85 | "responses": { 86 | "200": { 87 | "description": "Successful response", 88 | "content": { 89 | "application/json": {} 90 | } 91 | } 92 | } 93 | } 94 | } 95 | } 96 | } -------------------------------------------------------------------------------- /test/resources/output/Basic.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Postman to OpenAPI 4 | description: Mi super test collection from postman 5 | version: 1.1.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /users: 10 | post: 11 | tags: 12 | - default 13 | summary: Create new User 14 | description: Create a new user into your amazing API 15 | requestBody: 16 | content: 17 | application/json: 18 | schema: 19 | type: object 20 | example: 21 | example: field 22 | other: 23 | data1: 'yes' 24 | data2: 'no' 25 | responses: 26 | '200': 27 | description: Successful response 28 | content: 29 | application/json: {} 30 | /posts: 31 | post: 32 | tags: 33 | - default 34 | summary: Create a post 35 | requestBody: 36 | content: 37 | text/plain: {} 38 | responses: 39 | '200': 40 | description: Successful response 41 | content: 42 | application/json: {} 43 | /note: 44 | post: 45 | tags: 46 | - default 47 | summary: Create a note 48 | description: Just an example of text raw body 49 | requestBody: 50 | content: 51 | text/plain: 52 | schema: 53 | type: string 54 | example: This is an example Note 55 | responses: 56 | '200': 57 | description: Successful response 58 | content: 59 | application/json: {} 60 | -------------------------------------------------------------------------------- /test/resources/output/BasicNoOptions.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Postman to OpenAPI 4 | description: Mi super test collection from postman 5 | version: 1.1.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /users: 10 | post: 11 | tags: 12 | - default 13 | summary: Create new User 14 | description: Create a new user into your amazing API 15 | requestBody: 16 | content: 17 | '*/*': 18 | schema: 19 | type: string 20 | example: >- 21 | "{\n \"example\": \"field\",\n \"other\": {\n 22 | \"data1\": \"yes\",\n \"data2\": \"no\"\n }\n}" 23 | responses: 24 | '200': 25 | description: Successful response 26 | content: 27 | application/json: {} 28 | /posts: 29 | post: 30 | tags: 31 | - default 32 | summary: Create a post 33 | requestBody: 34 | content: 35 | text/plain: {} 36 | responses: 37 | '200': 38 | description: Successful response 39 | content: 40 | application/json: {} 41 | /note: 42 | post: 43 | tags: 44 | - default 45 | summary: Create a note 46 | description: Just an example of text raw body 47 | requestBody: 48 | content: 49 | text/plain: 50 | schema: 51 | type: string 52 | example: This is an example Note 53 | responses: 54 | '200': 55 | description: Successful response 56 | content: 57 | application/json: {} 58 | -------------------------------------------------------------------------------- /test/resources/output/BasicWithAuth.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Postman to OpenAPI 4 | description: Mi super test collection from postman 5 | version: 1.1.0 6 | servers: 7 | - url: https://api.io 8 | components: 9 | securitySchemes: 10 | myCustomAuth: 11 | type: http 12 | scheme: bearer 13 | bearerFormat: A resource owner JWT 14 | description: My awesome authentication using bearer 15 | myCustomAuth2: 16 | type: http 17 | scheme: basic 18 | description: My awesome authentication using user and password 19 | security: 20 | - myCustomAuth: [] 21 | - myCustomAuth2: [] 22 | paths: 23 | /users: 24 | post: 25 | tags: 26 | - default 27 | summary: Create new User 28 | description: Create a new user into your amazing API 29 | requestBody: 30 | content: 31 | application/json: 32 | schema: 33 | type: object 34 | example: 35 | example: field 36 | other: 37 | data1: 'yes' 38 | data2: 'no' 39 | responses: 40 | '200': 41 | description: Successful response 42 | content: 43 | application/json: {} 44 | /posts: 45 | post: 46 | tags: 47 | - default 48 | summary: Create a post 49 | requestBody: 50 | content: 51 | text/plain: {} 52 | responses: 53 | '200': 54 | description: Successful response 55 | content: 56 | application/json: {} 57 | /note: 58 | post: 59 | tags: 60 | - default 61 | summary: Create a note 62 | description: Just an example of text raw body 63 | requestBody: 64 | content: 65 | text/plain: 66 | schema: 67 | type: string 68 | example: This is an example Note 69 | responses: 70 | '200': 71 | description: Successful response 72 | content: 73 | application/json: {} 74 | -------------------------------------------------------------------------------- /test/resources/output/CollectionWrapper.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: AuthBasic 4 | description: Collection to test authorization global 5 | version: 1.0.0 6 | servers: 7 | - url: https://api.io 8 | components: 9 | securitySchemes: 10 | basicAuth: 11 | type: http 12 | scheme: basic 13 | security: 14 | - basicAuth: [] 15 | paths: 16 | /users: 17 | post: 18 | tags: 19 | - default 20 | summary: Create new User Copy 21 | description: Create a new user into your amazing API 22 | requestBody: 23 | content: 24 | application/json: 25 | schema: 26 | type: object 27 | example: 28 | example: field 29 | other: 30 | data1: 'yes' 31 | data2: 'no' 32 | responses: 33 | '200': 34 | description: Successful response 35 | content: 36 | application/json: {} 37 | get: 38 | tags: 39 | - default 40 | summary: Get list of users 41 | description: Obtain a list of users that fullfill the conditions of the filters 42 | parameters: 43 | - name: age 44 | in: query 45 | schema: 46 | type: integer 47 | description: Filter by age 48 | example: '45' 49 | - name: name 50 | in: query 51 | schema: 52 | type: string 53 | description: Filter by name 54 | example: Jhon 55 | - name: review 56 | in: query 57 | schema: 58 | type: boolean 59 | description: Indicate if should be reviewed or not 60 | example: 'true' 61 | - name: number 62 | in: query 63 | schema: 64 | type: number 65 | description: This is a number 66 | example: '23.56' 67 | responses: 68 | '200': 69 | description: Successful response 70 | content: 71 | application/json: {} 72 | -------------------------------------------------------------------------------- /test/resources/output/CustomTag.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Simple Post 4 | description: Just a simple collection for test 5 | version: 2.3.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /users: 10 | post: 11 | tags: 12 | - Custom Tag 13 | summary: Create new User 14 | description: Create a new user into your amazing API 15 | requestBody: 16 | content: 17 | application/json: 18 | schema: 19 | type: object 20 | example: 21 | example: field 22 | other: 23 | data1: 'yes' 24 | data2: 'no' 25 | responses: 26 | '200': 27 | description: Successful response 28 | content: 29 | application/json: {} 30 | /raw: 31 | post: 32 | tags: 33 | - Custom Tag 34 | summary: Post empty raw 35 | description: Create a new user into your amazing API 36 | requestBody: 37 | content: 38 | application/json: 39 | schema: 40 | type: object 41 | example: '' 42 | responses: 43 | '200': 44 | description: Successful response 45 | content: 46 | application/json: {} 47 | -------------------------------------------------------------------------------- /test/resources/output/DeleteOperation.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Delete Operation 4 | description: Mi super test collection from postman 5 | version: 1.1.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /users: 10 | delete: 11 | tags: 12 | - default 13 | summary: Delete all users 14 | description: Delete all the existing users 15 | responses: 16 | '200': 17 | description: Successful response 18 | content: 19 | application/json: {} 20 | -------------------------------------------------------------------------------- /test/resources/output/DepthPathParams.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Large Path Params 4 | description: Collection to test path parameters 5 | version: 1.0.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /users/{user_id}: 10 | get: 11 | tags: 12 | - default 13 | summary: Get one users info 14 | description: Obtain a list of users that fullfill the conditions of the filters 15 | parameters: 16 | - name: user_id 17 | in: path 18 | schema: 19 | type: string 20 | required: true 21 | responses: 22 | '200': 23 | description: Successful response 24 | content: 25 | application/json: {} 26 | /user/{user_id}/desc/: 27 | get: 28 | tags: 29 | - default 30 | summary: Get descriptions of a user 31 | description: Obtain a list of users descriptions 32 | parameters: 33 | - name: user_id 34 | in: path 35 | schema: 36 | type: number 37 | required: true 38 | description: This is just a user identifier 39 | example: '476587598' 40 | responses: 41 | '200': 42 | description: Successful response 43 | content: 44 | application/json: {} 45 | /user/{user_id}/desc/{desc_id}: 46 | get: 47 | tags: 48 | - default 49 | summary: Get a description from an user 50 | description: Obtain a list of users descriptions 51 | parameters: 52 | - name: user_id 53 | in: path 54 | schema: 55 | type: number 56 | required: true 57 | description: This is just a user identifier 58 | example: '476587598' 59 | - name: desc_id 60 | in: path 61 | schema: 62 | type: string 63 | required: true 64 | description: Description id 65 | example: ALMT 66 | responses: 67 | '200': 68 | description: Successful response 69 | content: 70 | application/json: {} 71 | -------------------------------------------------------------------------------- /test/resources/output/DisabledParamsAll.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: DisabledParams 4 | description: Test API for disabled parameters feature 5 | version: 1.0.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /{section}/users: 10 | get: 11 | tags: 12 | - default 13 | summary: Get list of users 14 | description: Obtain a list of users that fullfill the conditions of the filters 15 | parameters: 16 | - name: X-My-Header 17 | in: header 18 | schema: 19 | type: string 20 | required: true 21 | description: Custom header 22 | example: hudjilksns78jsijns090 23 | - name: X-Other 24 | in: header 25 | schema: 26 | type: string 27 | required: true 28 | description: Another header 29 | example: other 30 | - name: No-description 31 | in: header 32 | schema: 33 | type: string 34 | example: header without description 35 | - name: No-value 36 | in: header 37 | schema: 38 | type: string 39 | description: header without value 40 | - name: X-Disabled-Header 41 | in: header 42 | schema: 43 | type: string 44 | description: Disabled parameter 45 | example: QWERTY 46 | - name: age 47 | in: query 48 | schema: 49 | type: integer 50 | description: Disabled param 51 | example: '45' 52 | - name: name 53 | in: query 54 | schema: 55 | type: string 56 | description: Filter by name 57 | example: Jhon 58 | - name: review 59 | in: query 60 | schema: 61 | type: boolean 62 | description: Indicate if should be reviewed or not 63 | example: 'true' 64 | - name: section 65 | in: path 66 | schema: 67 | type: string 68 | required: true 69 | description: A path parameter 70 | example: spain 71 | responses: 72 | '200': 73 | description: Successful response 74 | content: 75 | application/json: {} 76 | -------------------------------------------------------------------------------- /test/resources/output/DisabledParamsDefault.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: DisabledParams 4 | description: Test API for disabled parameters feature 5 | version: 1.0.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /{section}/users: 10 | get: 11 | tags: 12 | - default 13 | summary: Get list of users 14 | description: Obtain a list of users that fullfill the conditions of the filters 15 | parameters: 16 | - name: X-My-Header 17 | in: header 18 | schema: 19 | type: string 20 | required: true 21 | description: Custom header 22 | example: hudjilksns78jsijns090 23 | - name: X-Other 24 | in: header 25 | schema: 26 | type: string 27 | required: true 28 | description: Another header 29 | example: other 30 | - name: No-description 31 | in: header 32 | schema: 33 | type: string 34 | example: header without description 35 | - name: No-value 36 | in: header 37 | schema: 38 | type: string 39 | description: header without value 40 | - name: name 41 | in: query 42 | schema: 43 | type: string 44 | description: Filter by name 45 | example: Jhon 46 | - name: review 47 | in: query 48 | schema: 49 | type: boolean 50 | description: Indicate if should be reviewed or not 51 | example: 'true' 52 | - name: section 53 | in: path 54 | schema: 55 | type: string 56 | required: true 57 | description: A path parameter 58 | example: spain 59 | responses: 60 | '200': 61 | description: Successful response 62 | content: 63 | application/json: {} 64 | -------------------------------------------------------------------------------- /test/resources/output/DisabledParamsHeader.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: DisabledParams 4 | description: Test API for disabled parameters feature 5 | version: 1.0.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /{section}/users: 10 | get: 11 | tags: 12 | - default 13 | summary: Get list of users 14 | description: Obtain a list of users that fullfill the conditions of the filters 15 | parameters: 16 | - name: X-My-Header 17 | in: header 18 | schema: 19 | type: string 20 | required: true 21 | description: Custom header 22 | example: hudjilksns78jsijns090 23 | - name: X-Other 24 | in: header 25 | schema: 26 | type: string 27 | required: true 28 | description: Another header 29 | example: other 30 | - name: No-description 31 | in: header 32 | schema: 33 | type: string 34 | example: header without description 35 | - name: No-value 36 | in: header 37 | schema: 38 | type: string 39 | description: header without value 40 | - name: X-Disabled-Header 41 | in: header 42 | schema: 43 | type: string 44 | description: Disabled parameter 45 | example: QWERTY 46 | - name: name 47 | in: query 48 | schema: 49 | type: string 50 | description: Filter by name 51 | example: Jhon 52 | - name: review 53 | in: query 54 | schema: 55 | type: boolean 56 | description: Indicate if should be reviewed or not 57 | example: 'true' 58 | - name: section 59 | in: path 60 | schema: 61 | type: string 62 | required: true 63 | description: A path parameter 64 | example: spain 65 | responses: 66 | '200': 67 | description: Successful response 68 | content: 69 | application/json: {} 70 | -------------------------------------------------------------------------------- /test/resources/output/DisabledParamsQuery.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: DisabledParams 4 | description: Test API for disabled parameters feature 5 | version: 1.0.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /{section}/users: 10 | get: 11 | tags: 12 | - default 13 | summary: Get list of users 14 | description: Obtain a list of users that fullfill the conditions of the filters 15 | parameters: 16 | - name: X-My-Header 17 | in: header 18 | schema: 19 | type: string 20 | required: true 21 | description: Custom header 22 | example: hudjilksns78jsijns090 23 | - name: X-Other 24 | in: header 25 | schema: 26 | type: string 27 | required: true 28 | description: Another header 29 | example: other 30 | - name: No-description 31 | in: header 32 | schema: 33 | type: string 34 | example: header without description 35 | - name: No-value 36 | in: header 37 | schema: 38 | type: string 39 | description: header without value 40 | - name: age 41 | in: query 42 | schema: 43 | type: integer 44 | description: Disabled param 45 | example: '45' 46 | - name: name 47 | in: query 48 | schema: 49 | type: string 50 | description: Filter by name 51 | example: Jhon 52 | - name: review 53 | in: query 54 | schema: 55 | type: boolean 56 | description: Indicate if should be reviewed or not 57 | example: 'true' 58 | - name: section 59 | in: path 60 | schema: 61 | type: string 62 | required: true 63 | description: A path parameter 64 | example: spain 65 | responses: 66 | '200': 67 | description: Successful response 68 | content: 69 | application/json: {} 70 | -------------------------------------------------------------------------------- /test/resources/output/EmptyUrl.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Simple Post 4 | description: Just a simple collection for test 5 | version: 2.3.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /users: 10 | post: 11 | tags: 12 | - default 13 | summary: Create new User 14 | description: Create a new user into your amazing API 15 | requestBody: 16 | content: 17 | application/json: 18 | schema: 19 | type: object 20 | example: 21 | example: field 22 | other: 23 | data1: 'yes' 24 | data2: 'no' 25 | responses: 26 | '200': 27 | description: Successful response 28 | content: 29 | application/json: {} 30 | -------------------------------------------------------------------------------- /test/resources/output/ExternalDocs.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: External Docs 4 | description: Just a simple collection for test 5 | version: 2.3.0 6 | externalDocs: 7 | url: https://docs.example.com 8 | description: Find more info here 9 | servers: 10 | - url: https://api.io 11 | paths: 12 | /users: 13 | post: 14 | tags: 15 | - default 16 | summary: Create new User 17 | description: Create a new user into your amazing API 18 | requestBody: 19 | content: 20 | application/json: 21 | schema: 22 | type: object 23 | example: 24 | example: field 25 | other: 26 | data1: 'yes' 27 | data2: 'no' 28 | responses: 29 | '200': 30 | description: Successful response 31 | content: 32 | application/json: {} 33 | -------------------------------------------------------------------------------- /test/resources/output/ExternalDocsOpts.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: External Docs 4 | description: Just a simple collection for test 5 | version: 2.3.0 6 | externalDocs: 7 | url: https://docs2.example.com 8 | description: Find more info here or there 9 | servers: 10 | - url: https://api.io 11 | paths: 12 | /users: 13 | post: 14 | tags: 15 | - default 16 | summary: Create new User 17 | description: Create a new user into your amazing API 18 | requestBody: 19 | content: 20 | application/json: 21 | schema: 22 | type: object 23 | example: 24 | example: field 25 | other: 26 | data1: 'yes' 27 | data2: 'no' 28 | responses: 29 | '200': 30 | description: Successful response 31 | content: 32 | application/json: {} 33 | -------------------------------------------------------------------------------- /test/resources/output/ExternalDocsOptsPartial.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Postman to OpenAPI 4 | description: Mi super test collection from postman 5 | version: 1.1.0 6 | externalDocs: 7 | url: https://docs2.example.com 8 | servers: 9 | - url: https://api.io 10 | paths: 11 | /users: 12 | post: 13 | tags: 14 | - default 15 | summary: Create new User 16 | description: Create a new user into your amazing API 17 | requestBody: 18 | content: 19 | application/json: 20 | schema: 21 | type: object 22 | example: 23 | example: field 24 | other: 25 | data1: 'yes' 26 | data2: 'no' 27 | responses: 28 | '200': 29 | description: Successful response 30 | content: 31 | application/json: {} 32 | /posts: 33 | post: 34 | tags: 35 | - default 36 | summary: Create a post 37 | requestBody: 38 | content: 39 | text/plain: {} 40 | responses: 41 | '200': 42 | description: Successful response 43 | content: 44 | application/json: {} 45 | /note: 46 | post: 47 | tags: 48 | - default 49 | summary: Create a note 50 | description: Just an example of text raw body 51 | requestBody: 52 | content: 53 | text/plain: 54 | schema: 55 | type: string 56 | example: This is an example Note 57 | responses: 58 | '200': 59 | description: Successful response 60 | content: 61 | application/json: {} 62 | -------------------------------------------------------------------------------- /test/resources/output/FormData.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Form Data 4 | description: Just a collection with a form data post for test 5 | version: 1.0.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /register: 10 | post: 11 | tags: 12 | - default 13 | summary: Register New User 14 | requestBody: 15 | content: 16 | multipart/form-data: 17 | schema: 18 | type: object 19 | required: 20 | - name 21 | - email 22 | properties: 23 | name: 24 | type: string 25 | description: full name of the user (accepts spaces) 26 | example: New User 27 | email: 28 | type: string 29 | description: email of the user (for notifications and login) 30 | example: newuser@example.com 31 | password: 32 | type: string 33 | example: pasword123 34 | profileImage: 35 | type: string 36 | description: User avatar 37 | format: binary 38 | responses: 39 | '200': 40 | description: Successful response 41 | content: 42 | application/json: {} 43 | -------------------------------------------------------------------------------- /test/resources/output/FormUrlencoded.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Form Url Encoded 4 | version: 1.0.0 5 | servers: 6 | - url: https://api.io 7 | paths: 8 | /register: 9 | post: 10 | tags: 11 | - default 12 | summary: Register New User 13 | requestBody: 14 | content: 15 | application/x-www-form-urlencoded: 16 | schema: 17 | type: object 18 | required: 19 | - name 20 | - email 21 | - password 22 | properties: 23 | name: 24 | type: string 25 | description: full name of the user (accepts spaces) 26 | example: New User 27 | email: 28 | type: string 29 | description: email of the user (for notifications and login) 30 | example: newuser@example.com 31 | password: 32 | type: string 33 | description: password (to be used for logging in) 34 | example: pasword123 35 | responses: 36 | '200': 37 | description: Successful response 38 | content: 39 | application/json: {} 40 | -------------------------------------------------------------------------------- /test/resources/output/GetMethods.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Get Methods 4 | description: API to manage GET methods 5 | version: 1.0.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /users: 10 | get: 11 | tags: 12 | - default 13 | summary: Get list of users 14 | description: Obtain a list of users that fullfill the conditions of the filters 15 | parameters: 16 | - name: age 17 | in: query 18 | schema: 19 | type: integer 20 | required: true 21 | description: Filter by age 22 | example: '45' 23 | - name: name 24 | in: query 25 | schema: 26 | type: string 27 | required: true 28 | description: Filter by name 29 | example: Jhon 30 | - name: review 31 | in: query 32 | schema: 33 | type: boolean 34 | description: Indicate if should be reviewed or not 35 | example: 'true' 36 | - name: number 37 | in: query 38 | schema: 39 | type: number 40 | description: This is a number 41 | example: '23.56' 42 | - name: required 43 | in: query 44 | schema: 45 | type: string 46 | required: true 47 | description: mandatory paraemeter 48 | example: my value 49 | - name: number1 50 | in: query 51 | schema: 52 | type: number 53 | description: Should be parsed as number 54 | example: '0.4565876' 55 | - name: number2 56 | in: query 57 | schema: 58 | type: number 59 | description: Should be parsed as number 60 | example: '123.45' 61 | - name: fake-number 62 | in: query 63 | schema: 64 | type: string 65 | description: Should be parsed as string 66 | example: 1.23.45 67 | - name: date 68 | in: query 69 | schema: 70 | type: string 71 | description: Should be parsed as string 72 | example: '2022-06-23T10:00:00.000+01:00' 73 | responses: 74 | '200': 75 | description: Successful response 76 | content: 77 | application/json: {} 78 | -------------------------------------------------------------------------------- /test/resources/output/Headers.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Headers 4 | description: API with headers 5 | version: 1.0.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /users: 10 | get: 11 | tags: 12 | - default 13 | summary: Get list of users 14 | description: Obtain a list of users that fullfill the conditions of the filters 15 | parameters: 16 | - name: X-My-Header 17 | in: header 18 | schema: 19 | type: string 20 | required: true 21 | description: Custom header 22 | example: hudjilksns78jsijns090 23 | - name: X-Other 24 | in: header 25 | schema: 26 | type: string 27 | required: true 28 | description: Another header 29 | example: other 30 | - name: No-description 31 | in: header 32 | schema: 33 | type: string 34 | example: header without description 35 | - name: No-value 36 | in: header 37 | schema: 38 | type: string 39 | description: header without value 40 | - name: name 41 | in: query 42 | schema: 43 | type: string 44 | description: Filter by name 45 | example: Jhon 46 | - name: review 47 | in: query 48 | schema: 49 | type: boolean 50 | description: Indicate if should be reviewed or not 51 | example: 'true' 52 | responses: 53 | '200': 54 | description: Successful response 55 | content: 56 | application/json: {} 57 | post: 58 | tags: 59 | - default 60 | summary: Create new User 61 | description: Create a new user into your amazing API 62 | requestBody: 63 | content: 64 | application/json: 65 | schema: 66 | type: object 67 | example: 68 | example: field 69 | other: 70 | data1: 'yes' 71 | data2: 'no' 72 | parameters: 73 | - name: Content-Type 74 | in: header 75 | schema: 76 | type: string 77 | description: Indicate the type of body sent by client 78 | example: application/json 79 | - name: X-My-Header 80 | in: header 81 | schema: 82 | type: string 83 | description: Custom header 84 | example: hudjilksns78jsijns090 85 | responses: 86 | '200': 87 | description: Successful response 88 | content: 89 | application/json: {} 90 | -------------------------------------------------------------------------------- /test/resources/output/InfoOpts.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Options title 4 | description: Description from options 5 | version: 6.0.7-beta 6 | termsOfService: http://tos.myweb.com 7 | servers: 8 | - url: https://api.io 9 | paths: 10 | /users: 11 | post: 12 | tags: 13 | - default 14 | summary: Create new User 15 | description: Create a new user into your amazing API 16 | requestBody: 17 | content: 18 | application/json: 19 | schema: 20 | type: object 21 | example: 22 | example: field 23 | other: 24 | data1: 'yes' 25 | data2: 'no' 26 | responses: 27 | '200': 28 | description: Successful response 29 | content: 30 | application/json: {} 31 | /raw: 32 | post: 33 | tags: 34 | - default 35 | summary: Post empty raw 36 | description: Create a new user into your amazing API 37 | requestBody: 38 | content: 39 | application/json: 40 | schema: 41 | type: object 42 | example: '' 43 | responses: 44 | '200': 45 | description: Successful response 46 | content: 47 | application/json: {} 48 | -------------------------------------------------------------------------------- /test/resources/output/LicenseContact.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: License and Contact 4 | description: Collection to test license as variable 5 | version: 1.0.0 6 | contact: 7 | name: API Support 8 | url: http://www.example.com/support 9 | email: support@example.com 10 | license: 11 | name: Apache 2.0 12 | url: https://www.apache.org/licenses/LICENSE-2.0.html 13 | servers: 14 | - url: https://api.io 15 | paths: 16 | /users: 17 | get: 18 | tags: 19 | - default 20 | summary: Get list of users 21 | description: Obtain a list of users that fullfill the conditions of the filters 22 | parameters: 23 | - name: age 24 | in: query 25 | schema: 26 | type: integer 27 | description: Filter by age 28 | example: '45' 29 | - name: name 30 | in: query 31 | schema: 32 | type: string 33 | description: Filter by name 34 | example: Jhon 35 | - name: review 36 | in: query 37 | schema: 38 | type: boolean 39 | description: Indicate if should be reviewed or not 40 | example: 'true' 41 | - name: number 42 | in: query 43 | schema: 44 | type: number 45 | description: This is a number 46 | example: '23.56' 47 | responses: 48 | '200': 49 | description: Successful response 50 | content: 51 | application/json: {} 52 | -------------------------------------------------------------------------------- /test/resources/output/LicenseContactOpts.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: License and Contact 4 | description: Collection to test license as variable 5 | version: 1.0.0 6 | contact: 7 | name: My Support 8 | url: http://www.api.com/support 9 | email: support@api.com 10 | license: 11 | name: MIT 12 | url: https://es.wikipedia.org/wiki/Licencia_MIT 13 | servers: 14 | - url: https://api.io 15 | paths: 16 | /users: 17 | get: 18 | tags: 19 | - default 20 | summary: Get list of users 21 | description: Obtain a list of users that fullfill the conditions of the filters 22 | parameters: 23 | - name: age 24 | in: query 25 | schema: 26 | type: integer 27 | description: Filter by age 28 | example: '45' 29 | - name: name 30 | in: query 31 | schema: 32 | type: string 33 | description: Filter by name 34 | example: Jhon 35 | - name: review 36 | in: query 37 | schema: 38 | type: boolean 39 | description: Indicate if should be reviewed or not 40 | example: 'true' 41 | - name: number 42 | in: query 43 | schema: 44 | type: number 45 | description: This is a number 46 | example: '23.56' 47 | responses: 48 | '200': 49 | description: Successful response 50 | content: 51 | application/json: {} 52 | -------------------------------------------------------------------------------- /test/resources/output/LicenseContactPartial.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Postman to OpenAPI 4 | description: Mi super test collection from postman 5 | version: 1.1.0 6 | contact: 7 | name: My Support 8 | license: 9 | name: MIT 10 | servers: 11 | - url: https://api.io 12 | paths: 13 | /users: 14 | post: 15 | tags: 16 | - default 17 | summary: Create new User 18 | description: Create a new user into your amazing API 19 | requestBody: 20 | content: 21 | application/json: 22 | schema: 23 | type: object 24 | example: 25 | example: field 26 | other: 27 | data1: 'yes' 28 | data2: 'no' 29 | responses: 30 | '200': 31 | description: Successful response 32 | content: 33 | application/json: {} 34 | /posts: 35 | post: 36 | tags: 37 | - default 38 | summary: Create a post 39 | requestBody: 40 | content: 41 | text/plain: {} 42 | responses: 43 | '200': 44 | description: Successful response 45 | content: 46 | application/json: {} 47 | /note: 48 | post: 49 | tags: 50 | - default 51 | summary: Create a note 52 | description: Just an example of text raw body 53 | requestBody: 54 | content: 55 | text/plain: 56 | schema: 57 | type: string 58 | example: This is an example Note 59 | responses: 60 | '200': 61 | description: Successful response 62 | content: 63 | application/json: {} 64 | -------------------------------------------------------------------------------- /test/resources/output/LicenseContactPartial2.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Postman to OpenAPI 4 | description: Mi super test collection from postman 5 | version: 1.1.0 6 | contact: 7 | url: http://www.api.com/support 8 | license: 9 | name: MIT 10 | servers: 11 | - url: https://api.io 12 | paths: 13 | /users: 14 | post: 15 | tags: 16 | - default 17 | summary: Create new User 18 | description: Create a new user into your amazing API 19 | requestBody: 20 | content: 21 | application/json: 22 | schema: 23 | type: object 24 | example: 25 | example: field 26 | other: 27 | data1: 'yes' 28 | data2: 'no' 29 | responses: 30 | '200': 31 | description: Successful response 32 | content: 33 | application/json: {} 34 | /posts: 35 | post: 36 | tags: 37 | - default 38 | summary: Create a post 39 | requestBody: 40 | content: 41 | text/plain: {} 42 | responses: 43 | '200': 44 | description: Successful response 45 | content: 46 | application/json: {} 47 | /note: 48 | post: 49 | tags: 50 | - default 51 | summary: Create a note 52 | description: Just an example of text raw body 53 | requestBody: 54 | content: 55 | text/plain: 56 | schema: 57 | type: string 58 | example: This is an example Note 59 | responses: 60 | '200': 61 | description: Successful response 62 | content: 63 | application/json: {} 64 | -------------------------------------------------------------------------------- /test/resources/output/MultipleServers.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: MultipleServers 4 | description: Collection to test multiples server parsing. 5 | version: 1.1.0 6 | servers: 7 | - url: https://api.io 8 | - url: https://api.dev.io 9 | - url: https://api.pre.io 10 | paths: 11 | /users: 12 | post: 13 | tags: 14 | - default 15 | summary: Create new User 16 | description: Create a new user into your amazing API 17 | requestBody: 18 | content: 19 | application/json: 20 | schema: 21 | type: object 22 | example: 23 | example: field 24 | other: 25 | data1: 'yes' 26 | data2: 'no' 27 | responses: 28 | '200': 29 | description: Successful response 30 | content: 31 | application/json: {} 32 | put: 33 | tags: 34 | - default 35 | summary: Update User 36 | description: Update an existing user 37 | requestBody: 38 | content: 39 | application/json: 40 | schema: 41 | type: object 42 | example: 43 | example: field 44 | other: 45 | data1: 'yes' 46 | data2: 'no' 47 | responses: 48 | '200': 49 | description: Successful response 50 | content: 51 | application/json: {} 52 | /posts: 53 | post: 54 | tags: 55 | - default 56 | summary: Create a post 57 | requestBody: 58 | content: 59 | text/plain: {} 60 | responses: 61 | '200': 62 | description: Successful response 63 | content: 64 | application/json: {} 65 | /note: 66 | post: 67 | tags: 68 | - default 69 | summary: Create a note 70 | description: Just an example of text raw body 71 | requestBody: 72 | content: 73 | text/plain: 74 | schema: 75 | type: string 76 | example: This is an example Note 77 | responses: 78 | '200': 79 | description: Successful response 80 | content: 81 | application/json: {} 82 | -------------------------------------------------------------------------------- /test/resources/output/NoPath.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: No Path 4 | description: API to manage GET methods 5 | version: 1.0.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /: 10 | get: 11 | tags: 12 | - default 13 | summary: Get list of users 14 | description: Obtain a list of users that fullfill the conditions of the filters 15 | parameters: 16 | - name: age 17 | in: query 18 | schema: 19 | type: integer 20 | required: true 21 | description: Filter by age 22 | example: '45' 23 | - name: name 24 | in: query 25 | schema: 26 | type: string 27 | required: true 28 | description: Filter by name 29 | example: Jhon 30 | - name: review 31 | in: query 32 | schema: 33 | type: boolean 34 | description: Indicate if should be reviewed or not 35 | example: 'true' 36 | - name: number 37 | in: query 38 | schema: 39 | type: number 40 | description: This is a number 41 | example: '23.56' 42 | - name: required 43 | in: query 44 | schema: 45 | type: string 46 | required: true 47 | description: mandatory paraemeter 48 | example: my value 49 | responses: 50 | '200': 51 | description: Successful response 52 | content: 53 | application/json: {} 54 | -------------------------------------------------------------------------------- /test/resources/output/NoServers.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: MultipleServers 4 | description: Collection to test multiples server parsing. 5 | version: 1.1.0 6 | paths: 7 | /users: 8 | post: 9 | tags: 10 | - default 11 | summary: Create new User 12 | description: Create a new user into your amazing API 13 | requestBody: 14 | content: 15 | application/json: 16 | schema: 17 | type: object 18 | example: 19 | example: field 20 | other: 21 | data1: 'yes' 22 | data2: 'no' 23 | responses: 24 | '200': 25 | description: Successful response 26 | content: 27 | application/json: {} 28 | put: 29 | tags: 30 | - default 31 | summary: Update User 32 | description: Update an existing user 33 | requestBody: 34 | content: 35 | application/json: 36 | schema: 37 | type: object 38 | example: 39 | example: field 40 | other: 41 | data1: 'yes' 42 | data2: 'no' 43 | responses: 44 | '200': 45 | description: Successful response 46 | content: 47 | application/json: {} 48 | /posts: 49 | post: 50 | tags: 51 | - default 52 | summary: Create a post 53 | requestBody: 54 | content: 55 | text/plain: {} 56 | responses: 57 | '200': 58 | description: Successful response 59 | content: 60 | application/json: {} 61 | /note: 62 | post: 63 | tags: 64 | - default 65 | summary: Create a note 66 | description: Just an example of text raw body 67 | requestBody: 68 | content: 69 | text/plain: 70 | schema: 71 | type: string 72 | example: This is an example Note 73 | responses: 74 | '200': 75 | description: Successful response 76 | content: 77 | application/json: {} 78 | -------------------------------------------------------------------------------- /test/resources/output/NoVersion.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: No Version Collection 4 | description: This collection don't have a version as variable 5 | version: 1.0.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /users: 10 | post: 11 | tags: 12 | - default 13 | summary: Create new User 14 | description: Create a new user into your amazing API 15 | requestBody: 16 | content: 17 | application/json: 18 | schema: 19 | type: object 20 | example: 21 | example: field 22 | other: 23 | data1: 'yes' 24 | data2: 'no' 25 | responses: 26 | '200': 27 | description: Successful response 28 | content: 29 | application/json: {} 30 | -------------------------------------------------------------------------------- /test/resources/output/NullHeader.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Information sociétaire 4 | version: 1.0.0 5 | servers: 6 | - url: http://{{url}} 7 | - url: https://api.io 8 | tags: 9 | - name: Authentification 10 | paths: 11 | /{webApp}/token: 12 | post: 13 | tags: 14 | - Authentification 15 | summary: Récupération token 16 | description: |- 17 | Méthode d'authentification 18 | Retourne un token en cas de succès 19 | requestBody: 20 | content: 21 | '*/*': 22 | schema: 23 | type: string 24 | example: >- 25 | "{\r\n \"contenu\":\r\n {\r\n \"compte\": \"{{compte}}\",\r\n 26 | \"motDePasse\": \"{{motDePasse}}\",\r\n \"identifiant\": 27 | \"{{identifiant}}\"\r\n }\r\n}" 28 | parameters: 29 | - name: Content-Type 30 | in: header 31 | schema: 32 | type: string 33 | example: application/json 34 | - name: webApp 35 | in: path 36 | schema: 37 | type: string 38 | required: true 39 | responses: 40 | '200': 41 | description: OK 42 | content: 43 | application/json: 44 | schema: 45 | type: object 46 | example: 47 | erreur: null 48 | codeErreur: 0 49 | contenu: 50 | token: ct54q7uoidffg2z661afigu98ix476s8 51 | /userHeader: 52 | post: 53 | tags: 54 | - Authentification 55 | summary: Missing headers field 56 | description: Create a new user into your amazing API 57 | requestBody: 58 | content: 59 | application/json: 60 | schema: 61 | type: object 62 | example: 63 | example: field 64 | other: 65 | data1: 'yes' 66 | data2: 'no' 67 | responses: 68 | '200': 69 | description: Successful response 70 | content: 71 | application/json: {} 72 | -------------------------------------------------------------------------------- /test/resources/output/OperationIds.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: OperationIds 4 | description: Mi super test collection from postman 5 | version: 1.1.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /users: 10 | post: 11 | tags: 12 | - default 13 | summary: Create new User 14 | description: Create a new user into your amazing API 15 | requestBody: 16 | content: 17 | application/json: 18 | schema: 19 | type: object 20 | example: 21 | example: field 22 | other: 23 | data1: 'yes' 24 | data2: 'no' 25 | responses: 26 | '200': 27 | description: Successful response 28 | content: 29 | application/json: {} 30 | /posts: 31 | post: 32 | tags: 33 | - default 34 | summary: Create a post 35 | requestBody: 36 | content: 37 | text/plain: {} 38 | responses: 39 | '200': 40 | description: Successful response 41 | content: 42 | application/json: {} 43 | /note: 44 | post: 45 | tags: 46 | - default 47 | summary: Create a note 48 | description: Just an example of text raw body 49 | requestBody: 50 | content: 51 | text/plain: 52 | schema: 53 | type: string 54 | example: This is an example Note 55 | responses: 56 | '200': 57 | description: Successful response 58 | content: 59 | application/json: {} 60 | -------------------------------------------------------------------------------- /test/resources/output/OperationIdsAuto.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: OperationIds 4 | description: Mi super test collection from postman 5 | version: 1.1.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /users: 10 | post: 11 | tags: 12 | - default 13 | summary: Create new User 14 | operationId: createNewUser 15 | description: Create a new user into your amazing API 16 | requestBody: 17 | content: 18 | application/json: 19 | schema: 20 | type: object 21 | example: 22 | example: field 23 | other: 24 | data1: 'yes' 25 | data2: 'no' 26 | responses: 27 | '200': 28 | description: Successful response 29 | content: 30 | application/json: {} 31 | /posts: 32 | post: 33 | tags: 34 | - default 35 | summary: Create a post 36 | operationId: createAPost 37 | requestBody: 38 | content: 39 | text/plain: {} 40 | responses: 41 | '200': 42 | description: Successful response 43 | content: 44 | application/json: {} 45 | /note: 46 | post: 47 | tags: 48 | - default 49 | summary: Create a note 50 | operationId: createANote 51 | description: Just an example of text raw body 52 | requestBody: 53 | content: 54 | text/plain: 55 | schema: 56 | type: string 57 | example: This is an example Note 58 | responses: 59 | '200': 60 | description: Successful response 61 | content: 62 | application/json: {} 63 | -------------------------------------------------------------------------------- /test/resources/output/OperationIdsBrackets.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: OperationIds 4 | description: Mi super test collection from postman 5 | version: 1.1.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /users: 10 | post: 11 | tags: 12 | - default 13 | summary: Create new User 14 | description: Create a new user into your amazing API 15 | requestBody: 16 | content: 17 | application/json: 18 | schema: 19 | type: object 20 | example: 21 | example: field 22 | other: 23 | data1: 'yes' 24 | data2: 'no' 25 | responses: 26 | '200': 27 | description: Successful response 28 | content: 29 | application/json: {} 30 | /posts: 31 | post: 32 | tags: 33 | - default 34 | summary: Create a post 35 | operationId: createPost 36 | requestBody: 37 | content: 38 | text/plain: {} 39 | responses: 40 | '200': 41 | description: Successful response 42 | content: 43 | application/json: {} 44 | /note: 45 | post: 46 | tags: 47 | - default 48 | summary: Create a note 49 | operationId: createNote 50 | description: Just an example of text raw body 51 | requestBody: 52 | content: 53 | text/plain: 54 | schema: 55 | type: string 56 | example: This is an example Note 57 | responses: 58 | '200': 59 | description: Successful response 60 | content: 61 | application/json: {} 62 | -------------------------------------------------------------------------------- /test/resources/output/ParseStatus.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Parse Status Code 4 | description: Just a simple collection for test status parsing 5 | version: 2.3.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /users: 10 | post: 11 | tags: 12 | - default 13 | summary: Create new User 201 14 | description: Example of a 201 response 15 | requestBody: 16 | content: 17 | application/json: 18 | schema: 19 | type: object 20 | example: 21 | example: field 22 | other: 23 | data1: 'yes' 24 | data2: 'no' 25 | responses: 26 | '201': 27 | description: Successful response 28 | content: 29 | application/json: {} 30 | /users/active: 31 | post: 32 | tags: 33 | - default 34 | summary: Create new User 202 35 | description: Example of a 202 response 36 | requestBody: 37 | content: 38 | application/json: 39 | schema: 40 | type: object 41 | example: 42 | example: field 43 | other: 44 | data1: 'yes' 45 | data2: 'no' 46 | responses: 47 | '202': 48 | description: Successful response 49 | content: 50 | application/json: {} 51 | /users/group: 52 | post: 53 | tags: 54 | - default 55 | summary: Deafult 200 56 | description: Example of a 202 response 57 | requestBody: 58 | content: 59 | application/json: 60 | schema: 61 | type: object 62 | example: 63 | example: field 64 | other: 65 | data1: 'yes' 66 | data2: 'no' 67 | responses: 68 | '200': 69 | description: Successful response 70 | content: 71 | application/json: {} 72 | -------------------------------------------------------------------------------- /test/resources/output/RawBody.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Raw Body 4 | description: Mi super test collection from postman 5 | version: 1.0.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /test: 10 | post: 11 | tags: 12 | - default 13 | summary: Test Raw Body 14 | description: Test Raw Body 15 | requestBody: 16 | content: 17 | text/plain: 18 | schema: 19 | type: string 20 | example: testesttestest 21 | responses: 22 | '200': 23 | description: Successful response 24 | content: 25 | application/json: {} 26 | -------------------------------------------------------------------------------- /test/resources/output/ResponsesNoHeaders.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Responses 4 | description: Postman collection with saved responses 5 | version: 1.2.0 6 | servers: 7 | - url: https://60bb37ab42e1d000176206c3.mockapi.io 8 | paths: 9 | /users: 10 | post: 11 | tags: 12 | - default 13 | summary: Create new User 14 | description: Create a new user into your amazing API 15 | requestBody: 16 | content: 17 | application/json: 18 | schema: 19 | type: object 20 | example: 21 | id: '100' 22 | createdAt: '2021-06-04T15:50:38.568Z' 23 | name: Carol 24 | avatar: https://cdn.fakercloud.com/avatars/nelsonjoyce_128.jpg 25 | responses: 26 | '201': 27 | description: Created 28 | content: 29 | application/json: 30 | schema: 31 | type: object 32 | examples: 33 | example-0: 34 | summary: Create new User example 35 | value: 36 | id: '51' 37 | createdAt: '2021-06-04T15:50:38.568Z' 38 | name: Carol 39 | avatar: https://cdn.fakercloud.com/avatars/nelsonjoyce_128.jpg 40 | example-1: 41 | summary: Create new User automatic id 42 | value: 43 | id: '54' 44 | createdAt: '2021-06-04T15:50:38.568Z' 45 | name: Carol 46 | avatar: https://cdn.fakercloud.com/avatars/nelsonjoyce_128.jpg 47 | /users/{user_id}: 48 | get: 49 | tags: 50 | - default 51 | summary: Get User data 52 | description: Retrieve the user data 53 | parameters: 54 | - name: user_id 55 | in: path 56 | schema: 57 | type: number 58 | required: true 59 | description: This is just a user identifier 60 | example: '54' 61 | responses: 62 | '200': 63 | description: OK 64 | content: 65 | application/json: 66 | schema: 67 | type: object 68 | example: 69 | id: '50' 70 | createdAt: '2021-06-04T23:41:02.287Z' 71 | name: Leanne 72 | avatar: https://cdn.fakercloud.com/avatars/bartjo_128.jpg 73 | '404': 74 | description: Not Found 75 | content: 76 | text/plain: 77 | schema: 78 | type: string 79 | example: '"Not found"' 80 | -------------------------------------------------------------------------------- /test/resources/output/ServersOpts.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: MultipleServers 4 | description: Collection to test multiples server parsing. 5 | version: 1.1.0 6 | servers: 7 | - url: https://awesome.api.sandbox.io 8 | description: Sandbox environment server 9 | - url: https://awesome.api.io 10 | description: Production env 11 | paths: 12 | /users: 13 | post: 14 | tags: 15 | - default 16 | summary: Create new User 17 | description: Create a new user into your amazing API 18 | requestBody: 19 | content: 20 | application/json: 21 | schema: 22 | type: object 23 | example: 24 | example: field 25 | other: 26 | data1: 'yes' 27 | data2: 'no' 28 | responses: 29 | '200': 30 | description: Successful response 31 | content: 32 | application/json: {} 33 | put: 34 | tags: 35 | - default 36 | summary: Update User 37 | description: Update an existing user 38 | requestBody: 39 | content: 40 | application/json: 41 | schema: 42 | type: object 43 | example: 44 | example: field 45 | other: 46 | data1: 'yes' 47 | data2: 'no' 48 | responses: 49 | '200': 50 | description: Successful response 51 | content: 52 | application/json: {} 53 | /posts: 54 | post: 55 | tags: 56 | - default 57 | summary: Create a post 58 | requestBody: 59 | content: 60 | text/plain: {} 61 | responses: 62 | '200': 63 | description: Successful response 64 | content: 65 | application/json: {} 66 | /note: 67 | post: 68 | tags: 69 | - default 70 | summary: Create a note 71 | description: Just an example of text raw body 72 | requestBody: 73 | content: 74 | text/plain: 75 | schema: 76 | type: string 77 | example: This is an example Note 78 | responses: 79 | '200': 80 | description: Successful response 81 | content: 82 | application/json: {} 83 | -------------------------------------------------------------------------------- /test/resources/output/UrlWithPort.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Url with Port 4 | description: Just a simple collection for test 5 | version: 2.3.0 6 | servers: 7 | - url: https://api.io:453 8 | paths: 9 | /users: 10 | post: 11 | tags: 12 | - default 13 | summary: Create new User 14 | description: Create a new user into your amazing API 15 | requestBody: 16 | content: 17 | application/json: 18 | schema: 19 | type: object 20 | example: 21 | example: field 22 | other: 23 | data1: 'yes' 24 | data2: 'no' 25 | responses: 26 | '200': 27 | description: Successful response 28 | content: 29 | application/json: {} 30 | -------------------------------------------------------------------------------- /test/resources/output/Variables.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Variables 4 | description: Mi super test collection from postman 5 | version: 1.1.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /users: 10 | post: 11 | tags: 12 | - default 13 | summary: Create new User 14 | description: Create a new user into your amazing API 15 | requestBody: 16 | content: 17 | application/json: 18 | schema: 19 | type: object 20 | example: 21 | example: field 22 | other: 23 | data1: 'yes' 24 | service: s23434 25 | responses: 26 | '200': 27 | description: Successful response 28 | content: 29 | application/json: {} 30 | get: 31 | tags: 32 | - default 33 | summary: Get a list of user 34 | description: Get a list of users 35 | parameters: 36 | - name: size 37 | in: query 38 | schema: 39 | type: integer 40 | description: size of the list 41 | example: '10' 42 | - name: company 43 | in: query 44 | schema: 45 | type: string 46 | description: company for filter users 47 | example: ServicesLTD 48 | responses: 49 | '200': 50 | description: Successful response 51 | content: 52 | application/json: {} 53 | /test/path/here/post: 54 | post: 55 | tags: 56 | - default 57 | summary: Create Post 58 | requestBody: 59 | content: 60 | multipart/form-data: 61 | schema: 62 | type: object 63 | properties: 64 | company: 65 | type: string 66 | example: ServicesLTD 67 | text: 68 | type: string 69 | example: This is an example text 70 | auditor: 71 | type: string 72 | example: IHA 73 | responses: 74 | '200': 75 | description: Successful response 76 | content: 77 | application/json: {} 78 | /users/{user_id}: 79 | get: 80 | tags: 81 | - default 82 | summary: Consult User data 83 | description: Get one user instance data 84 | parameters: 85 | - name: X-Company 86 | in: header 87 | schema: 88 | type: string 89 | example: ServicesLTD 90 | - name: company 91 | in: query 92 | schema: 93 | type: string 94 | example: ServicesLTD 95 | - name: user_id 96 | in: path 97 | schema: 98 | type: string 99 | required: true 100 | responses: 101 | '200': 102 | description: Successful response 103 | content: 104 | application/json: {} 105 | -------------------------------------------------------------------------------- /test/resources/output/VariablesAdditional.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Variables 4 | description: Mi super test collection from postman 5 | version: 1.1.0 6 | servers: 7 | - url: https://api.io 8 | paths: 9 | /users: 10 | post: 11 | tags: 12 | - default 13 | summary: Create new User 14 | description: Create a new user into your amazing API 15 | requestBody: 16 | content: 17 | application/json: 18 | schema: 19 | type: object 20 | example: 21 | example: field 22 | other: 23 | data1: 'yes' 24 | service: myService 25 | responses: 26 | '200': 27 | description: Successful response 28 | content: 29 | application/json: {} 30 | get: 31 | tags: 32 | - default 33 | summary: Get a list of user 34 | description: Get a list of users 35 | parameters: 36 | - name: size 37 | in: query 38 | schema: 39 | type: integer 40 | description: size of the list 41 | example: '10' 42 | - name: company 43 | in: query 44 | schema: 45 | type: string 46 | description: company for filter users 47 | example: myCompany 48 | responses: 49 | '200': 50 | description: Successful response 51 | content: 52 | application/json: {} 53 | /test/path/here/post: 54 | post: 55 | tags: 56 | - default 57 | summary: Create Post 58 | requestBody: 59 | content: 60 | multipart/form-data: 61 | schema: 62 | type: object 63 | properties: 64 | company: 65 | type: string 66 | example: myCompany 67 | text: 68 | type: string 69 | example: This is an example text 70 | auditor: 71 | type: string 72 | example: IHA 73 | responses: 74 | '200': 75 | description: Successful response 76 | content: 77 | application/json: {} 78 | /users/{user_id}: 79 | get: 80 | tags: 81 | - default 82 | summary: Consult User data 83 | description: Get one user instance data 84 | parameters: 85 | - name: X-Company 86 | in: header 87 | schema: 88 | type: string 89 | example: myCompany 90 | - name: company 91 | in: query 92 | schema: 93 | type: string 94 | example: myCompany 95 | - name: user_id 96 | in: path 97 | schema: 98 | type: string 99 | required: true 100 | responses: 101 | '200': 102 | description: Successful response 103 | content: 104 | application/json: {} 105 | -------------------------------------------------------------------------------- /test/resources/output/XLogo.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Simple Post 4 | description: Just a simple collection for test 5 | version: 2.3.0 6 | x-logo: 7 | url: https://github.com/joolfe/logoBanner.png 8 | backgroundColor: '#FFFFFF' 9 | altText: Example logo 10 | href: https://github.com/joolfe/here.html 11 | servers: 12 | - url: https://api.io 13 | paths: 14 | /users: 15 | post: 16 | tags: 17 | - default 18 | summary: Create new User 19 | description: Create a new user into your amazing API 20 | requestBody: 21 | content: 22 | application/json: 23 | schema: 24 | type: object 25 | example: 26 | example: field 27 | other: 28 | data1: 'yes' 29 | data2: 'no' 30 | responses: 31 | '200': 32 | description: Successful response 33 | content: 34 | application/json: {} 35 | /raw: 36 | post: 37 | tags: 38 | - default 39 | summary: Post empty raw 40 | description: Create a new user into your amazing API 41 | requestBody: 42 | content: 43 | application/json: 44 | schema: 45 | type: object 46 | example: '' 47 | responses: 48 | '200': 49 | description: Successful response 50 | content: 51 | application/json: {} 52 | -------------------------------------------------------------------------------- /test/resources/output/XLogoVar.yml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Simple Post 4 | description: Just a simple collection for test 5 | version: 2.3.0 6 | x-logo: 7 | url: https://github.com/joolfe/mylogo.png 8 | backgroundColor: '#000FFF' 9 | altText: Othert text for logo 10 | href: https://github.com/joolfe/here.html 11 | servers: 12 | - url: https://api.io 13 | paths: 14 | /users: 15 | post: 16 | tags: 17 | - default 18 | summary: Create new User 19 | description: Create a new user into your amazing API 20 | requestBody: 21 | content: 22 | application/json: 23 | schema: 24 | type: object 25 | example: 26 | example: field 27 | other: 28 | data1: 'yes' 29 | data2: 'no' 30 | responses: 31 | '200': 32 | description: Successful response 33 | content: 34 | application/json: {} 35 | /raw: 36 | post: 37 | tags: 38 | - default 39 | summary: Post empty raw 40 | description: Create a new user into your amazing API 41 | requestBody: 42 | content: 43 | application/json: 44 | schema: 45 | type: object 46 | example: '' 47 | responses: 48 | '200': 49 | description: Successful response 50 | content: 51 | application/json: {} 52 | -------------------------------------------------------------------------------- /test/var-replacer.spec.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const { describe, it } = require('mocha') 4 | const { readFileSync } = require('fs') 5 | const { equal } = require('assert').strict 6 | const replacePostmanVariables = require('../lib/var-replacer') 7 | 8 | describe('replacePostmanVariables specs', function () { 9 | const VARIABLES_COLLECTION_V2 = readFileSync('./test/resources/input/v2/Variables.json', 'utf8') 10 | const VARIABLES_COLLECTION_V21 = readFileSync('./test/resources/input/v21/Variables.json', 'utf8') 11 | const RESULT_V2 = readFileSync('./test/resources/var-replace/VariablesReplacedV2.json', 'utf8') 12 | const RESULT_V21 = readFileSync('./test/resources/var-replace/VariablesReplacedV21.json', 'utf8') 13 | const RESULT_ADDITIONAL_V2 = readFileSync('./test/resources/var-replace/VariablesReplacedV2additional.json', 'utf8') 14 | const RESULT_ADDITIONAL_V21 = readFileSync('./test/resources/var-replace/VariablesReplacedV21additional.json', 'utf8') 15 | 16 | it('should replace all variables successfully v2', async function () { 17 | const output = replacePostmanVariables(VARIABLES_COLLECTION_V2) 18 | equal(output, RESULT_V2) 19 | }) 20 | 21 | it('should replace all variables successfully v2.1', async function () { 22 | const output = replacePostmanVariables(VARIABLES_COLLECTION_V21) 23 | equal(output, RESULT_V21) 24 | }) 25 | 26 | it('should use additional vars', async function () { 27 | const output = replacePostmanVariables(VARIABLES_COLLECTION_V2, { 28 | company: 'myCompany', 29 | service: 'myService' 30 | }) 31 | equal(output, RESULT_ADDITIONAL_V2) 32 | }) 33 | 34 | it('should replace all variables successfully v2.1', async function () { 35 | const output = replacePostmanVariables(VARIABLES_COLLECTION_V21, { 36 | company: 'myCompany', 37 | service: 'myService' 38 | }) 39 | equal(output, RESULT_ADDITIONAL_V21) 40 | }) 41 | }) 42 | -------------------------------------------------------------------------------- /types/index.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Object that contain the license information as defined in 4 | * https://spec.openapis.org/oas/v3.0.3.html#contactObject 5 | */ 6 | export interface ContactObject { 7 | name?: string, 8 | url?: string, 9 | email?: string 10 | } 11 | 12 | /** 13 | * Object that contain the license information as defined in 14 | * https://spec.openapis.org/oas/v3.0.3.html#licenseObject 15 | */ 16 | export interface LicenseObject { 17 | name: string, 18 | url?: string 19 | } 20 | 21 | /** 22 | * Object that contain the api information as defined in 23 | * https://spec.openapis.org/oas/v3.0.3.html#info-object 24 | */ 25 | export interface InfoObject { 26 | title?: string, 27 | description?: string, 28 | termsOfService?: string, 29 | contact?: ContactObject, 30 | license?: LicenseObject, 31 | version?: string, 32 | } 33 | 34 | /** 35 | * Object that contain the servers information as defined in 36 | * https://spec.openapis.org/oas/v3.0.3.html#server-object 37 | * field `variables`is not supported yet 38 | */ 39 | export interface ServerObject { 40 | url: string, 41 | description?: string 42 | } 43 | 44 | /** 45 | * Object that contain the servers information as defined in 46 | * https://spec.openapis.org/oas/v3.0.3.html#security-scheme-object 47 | */ 48 | export interface SecurityObject { 49 | type: 'http', 50 | description?: string, 51 | scheme: 'bearer' | 'basic', 52 | bearerFormat?: string 53 | } 54 | 55 | export interface AuthOptions { 56 | [key: string]: SecurityObject 57 | } 58 | 59 | /** 60 | * Object that contain the external docs information as defined in 61 | * https://spec.openapis.org/oas/v3.0.3.html#external-documentation-object 62 | */ 63 | export interface ExternalDocsObject { 64 | description?: string, 65 | url?: string 66 | } 67 | 68 | export interface FoldersOption { 69 | concat: boolean, 70 | separator: string 71 | } 72 | 73 | export interface DisabledParamsOptions { 74 | // Default to `false` 75 | includeQuery?: boolean, 76 | // Default to `false` 77 | includeHeader?: boolean 78 | } 79 | 80 | export interface Options { 81 | info?: InfoObject, 82 | defaultTag?: string, 83 | pathDepth?: number, 84 | auth?: AuthOptions, 85 | servers?: Array, 86 | externalDocs?: ExternalDocsObject, 87 | folders?: FoldersOption, 88 | // Default value true 89 | responseHeaders?: boolean, 90 | // Default value false 91 | replaceVars?: boolean, 92 | additionalVars?: { [key: string]: string }, 93 | // Default value 'yaml' 94 | outputFormat?: 'json' | 'yaml', 95 | disabledParams?: DisabledParamsOptions, 96 | // Default value 'off' 97 | operationId?: 'off' | 'auto' | 'brackets' 98 | } 99 | 100 | export default function postmanToOpenApi (input: string, output?: string, options?: Options) : Promise 101 | -------------------------------------------------------------------------------- /types/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "lib": ["ES6"], 5 | "noImplicitAny": true, 6 | "noImplicitThis": true, 7 | "strictNullChecks": true, 8 | "strictFunctionTypes": true, 9 | "baseUrl": "../", 10 | "typeRoots": ["../"], 11 | "types": [], 12 | "noEmit": true, 13 | "forceConsistentCasingInFileNames": true 14 | 15 | }, 16 | "files": [ 17 | "index.d.ts", 18 | "typescript-test.ts" 19 | ] 20 | } -------------------------------------------------------------------------------- /types/typescript-test.ts: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | import postmanToOpenApi, { 4 | Options, ContactObject, LicenseObject, InfoObject, 5 | ServerObject, SecurityObject, ExternalDocsObject, 6 | FoldersOption, 7 | } from './index.d' 8 | 9 | const contact:ContactObject = { 10 | name: 'My Enterprise', 11 | url: 'http://fancyEnterprise.com', 12 | email: 'support@myfancy.com' 13 | } 14 | 15 | const license:LicenseObject = { 16 | name: 'MIT', 17 | url: 'http://fancyEnterprise.com/mit' 18 | } 19 | 20 | const info:InfoObject = { 21 | title: 'Amazing API', 22 | description: 'The best API you can find out there', 23 | termsOfService: 'http://fancyEnterprise.com/tos', 24 | contact, 25 | license, 26 | version: '1.0.1' 27 | } 28 | 29 | const serverDev: ServerObject = { 30 | url: 'http://fancyEnterprise.com/dev', 31 | description: 'Development environment' 32 | } 33 | 34 | const serverPro: ServerObject = { 35 | url: 'http://fancyEnterprise.com/api', 36 | description: 'Live environment' 37 | } 38 | 39 | const basicAuth:SecurityObject = { 40 | type: 'http', 41 | description: 'Basic authentication using user and password', 42 | scheme: 'basic' 43 | } 44 | 45 | const bearerAuth:SecurityObject = { 46 | type: 'http', 47 | description: 'Bearer authentication', 48 | scheme: 'bearer', 49 | bearerFormat: 'Signed JWT' 50 | } 51 | 52 | const externalDocs:ExternalDocsObject = { 53 | description: 'Fancy API documentation in detail', 54 | url: 'http://fancyEnterprise.com/dev' 55 | } 56 | 57 | const folders:FoldersOption = { 58 | concat: true, 59 | separator: '->' 60 | } 61 | 62 | const options:Options = { 63 | info, 64 | defaultTag: 'my Tag', 65 | pathDepth: 0, 66 | auth: { 67 | 'basicAuth': basicAuth, 68 | 'bearerAuth': bearerAuth 69 | }, 70 | servers: [serverDev, serverPro], 71 | externalDocs, 72 | folders 73 | }; 74 | 75 | const options2:Options = { 76 | info, 77 | defaultTag: 'my Tag', 78 | pathDepth: 0, 79 | auth: { 80 | 'basicAuth': basicAuth, 81 | 'bearerAuth': bearerAuth 82 | }, 83 | servers: [serverDev, serverPro], 84 | externalDocs, 85 | folders, 86 | responseHeaders: false, 87 | replaceVars: false, 88 | additionalVars: { 89 | 'key': 'value', 90 | 'key2': 'value2' 91 | } 92 | }; 93 | 94 | (async () => { 95 | 96 | const openAPI1 = postmanToOpenApi('./path/to/postman_collection.json') 97 | 98 | const openAPI2 = postmanToOpenApi('./path/to/postman_collection.json', './path/to/result/openApi.yml') 99 | 100 | const openAPI3 = postmanToOpenApi('./path/to/postman_collection.json', './path/to/result/openApi.yml', options) 101 | 102 | const openAPI4 = postmanToOpenApi('./path/to/postman_collection.json', './path/to/result/openApi.yml', options2) 103 | 104 | })(); 105 | --------------------------------------------------------------------------------