openapi-postman-test-generator · cli for node.js
Point it at a Swagger 2.0 or OpenAPI 3.x document and it generates a full Postman collection — auth, example bodies, JSON Schema assertions, and negative tests — ready to run with Newman.
The generator is deterministic. An optional AI planner may propose operation order and variable mappings — it never writes the Postman scripts.
$ openapi-postman generate --spec ./petstore.openapi.yaml --negative Generated 8 requests Collection: ./generated/api.collection.json Environment: ./generated/api.environment.json $ openapi-postman run --collection ./generated/api.collection.json ✓ report.html · junit.xml · newman.json
One route from the fixture used on this page — POST /pets in fixtures/petstore.openapi.yaml — traced from spec to generated request.
/pets: post: summary: Create pet requestBody: content: application/json: schema: { $ref: '#/NewPet' } responses: '201': content: application/json: schema: { $ref: '#/Pet' } NewPet: required: [name] properties: name: { example: Miso } status: { enum: [available, adopted] }
$ref chains, merge allOfpm.test() assertions"method": "POST", "url": "{{baseUrl}}/pets", "auth": { "type": "bearer" }, "body": { "raw": "{ \"name\": \"Miso\", \"status\": \"available\" }" } // event[0].script.exec pm.test("Status code is successful (201)", …) pm.test("Response time is below 2000ms", …) pm.test("Response matches the schema…", …)
The generated collection for the Pets API above, folders and negative tests included — exactly what generate --negative produced for this page.
openapi-postman run executes the collection with Newman and writes three reports:
DELETE operations when testing against an unfamiliar APIA provider-neutral planner can propose operation order and variable mappings from a read-only prompt, with schema-validated output and automatic fallback between providers. The deterministic generator still writes every Postman script.
$ npm install -g openapi-postman-test-generator $ npm install -g newman
$ openapi-postman generate --spec ./openapi.yaml --negative --safe
$ openapi-postman run --collection ./generated/api.collection.json --environment ./generated/api.environment.json