CLI options file
Store all Portman CLI options in a JSON or YAML file and pass it with --cliOptionsFile, ideal for versioned CI/CD setups.
The --cliOptionsFile flag loads Portman CLI options from a JSON or YAML file, so you can keep the whole command in version control instead of a long shell line. All available CLI options can be used in the file.
Usage
portman --cliOptionsFile ./examples/cli-options/portman-cli-options.jsonportman --cliOptionsFile ./examples/cli-options/portman-cli-options.yamlThe value can be a path or a URL.
JSON example
{ "local": "./examples/cli-options/crm.openapi.yml", "baseUrl": "http://localhost:3050", "output": "./examples/cli-options/crm.postman.json", "portmanConfigFile": "./examples/cli-options/portman-config.crm.json", "postmanConfigFile": "./examples/cli-options/postman-config.crm.json", "envFile": "./examples/cli-options/.lead.env", "includeTests": true, "syncPostman": false, "syncPostmanCollectionIds": false, "runNewman": false, "oaRename": "CRM API - Test suite"}YAML example
local: ./examples/cli-options/crm.openapi.ymlbaseUrl: 'http://localhost:3050'output: ./examples/cli-options/crm.postman.jsonportmanConfigFile: ./examples/cli-options/portman-config.crm.jsonpostmanConfigFile: ./examples/cli-options/postman-config.crm.jsonenvFile: ./examples/cli-options/.lead.envincludeTests: truesyncPostman: falsesyncPostmanCollectionIds: falserunNewman: falseoaRename: 'CRM API - Test suite'Keys
The keys use the long option names from CLI options, without the leading dashes. The keys in the example above:
| Key | Description |
|---|---|
local | Local OpenAPI file to convert. Use url for a remote spec. |
baseUrl | Overrides the spec's base URL in the generated collection. |
output | Where the generated Postman collection is written. |
portmanConfigFile | The Portman config file, in JSON or YAML. |
postmanConfigFile | The openapi-to-postman config file with conversion settings. |
envFile | The .env file used for environment variable injection. |
includeTests | Toggle generation of Postman tests. |
syncPostman | Toggle uploading the collection to Postman. |
syncPostmanCollectionIds | Keep collection IDs in sync with the collection already on Postman. |
runNewman | Toggle running Newman on the generated collection. |
oaRename | Changes the OpenAPI title and Postman collection name, handy when you want your original and your Portman-generated collection side by side. |
Overriding options from the command line
Options passed on the command line overwrite the options defined in the file. This lets you share one file and change a single value per run:
portman --cliOptionsFile ./portman-cli-options.json --baseUrl http://localhost:4000Newman options in the file
When runNewman is enabled, include Newman options as an object under newmanRunOptions:
{ "local": "./examples/cli-options/crm.openapi.yml", "baseUrl": "http://localhost:3050", "output": "./examples/cli-options/crm.postman.json", "portmanConfigFile": "./examples/cli-options/portman-config.crm.json", "postmanConfigFile": "./examples/cli-options/postman-config.crm.json", "envFile": "./examples/cli-options/.lead.env", "includeTests": true, "syncPostman": false, "runNewman": true, "newmanRunOptions": { "environment": "./tmp/crm/postman-dev.env.json", "iteration-count": 5, "ignore-redirects": true, "insecure": true }}See Running tests with Newman for more.
Filtering in the file
{ "url": "https://raw.githubusercontent.com/apideck-libraries/portman/main/examples/cli-filtering/crm.yml", "baseUrl": "http://localhost:3050", "output": "./examples/cli-filtering/crm.postman.json", "oaOutput": "./examples/cli-filtering/filtered-crm.leads.yml", "filterFile": "./examples/cli-filtering/oas-format-filter.json", "includeTests": true, "syncPostman": false, "runNewman": false}See Filtering operations.