API Spec Generator
Purpose
Turn any API description into a structured, importable collection for Postman or Bruno — with environment variables, auth, and test assertions pre-configured and ready to use.
Input Accepted
- Swagger / OpenAPI spec (JSON or YAML)
- List of endpoints with methods and body descriptions
- Single endpoint with headers, body, and auth
- Existing collection to extend or update
Output Options
Ask the user which format:
- Postman → Collection v2.1 JSON (import via File → Import in Postman)
- Bruno →
.brufiles +bruno.jsonmanifest - Both → generate both formats
Generation Process
Step 1 — Parse all endpoints: method, path, params, body schema, auth type.
Step 2 — Define environment variables:
{{base_url}} Base API URL
{{token}} Bearer auth token
{{admin_token}} Admin-level token (if needed)
{{user_id}} Dynamic user reference
Step 3 — For each endpoint generate:
- 1 happy path request (valid data, full headers)
- 1 negative case (missing required field or no auth)
- Pre-request script for Bearer auth
- Test assertions script
Step 4 — Assertions template (per request):
pm.test("Status code correct", () => pm.response.to.have.status(expectedCode));
pm.test("Response time < 2000ms", () => pm.expect(pm.response.responseTime).to.be.below(2000));
pm.test("Content-Type is JSON", () =>
pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json")
);
pm.test("Response body has expected field", () => {
const body = pm.response.json();
pm.expect(body).to.have.property("expected_field");
});
References
references/api-standards.md— Naming, organization, and assertion conventionsexamples/input-swagger.json— Example Swagger inputexamples/output-postman.json— Example Postman v2.1 outputexamples/output-bruno/— Example Bruno collection outputscripts/generate-collection.sh— CLI scaffold script