CLI

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

bash
portman --cliOptionsFile ./examples/cli-options/portman-cli-options.json
bash
portman --cliOptionsFile ./examples/cli-options/portman-cli-options.yaml

The value can be a path or a URL.

JSON example

json
{  "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

yaml
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:

KeyDescription
localLocal OpenAPI file to convert. Use url for a remote spec.
baseUrlOverrides the spec's base URL in the generated collection.
outputWhere the generated Postman collection is written.
portmanConfigFileThe Portman config file, in JSON or YAML.
postmanConfigFileThe openapi-to-postman config file with conversion settings.
envFileThe .env file used for environment variable injection.
includeTestsToggle generation of Postman tests.
syncPostmanToggle uploading the collection to Postman.
syncPostmanCollectionIdsKeep collection IDs in sync with the collection already on Postman.
runNewmanToggle running Newman on the generated collection.
oaRenameChanges 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:

bash
portman --cliOptionsFile ./portman-cli-options.json --baseUrl http://localhost:4000

Newman options in the file

When runNewman is enabled, include Newman options as an object under newmanRunOptions:

json
{  "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

json
{  "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.