ORM Studio

Export Collections

Generate Postman v2.1, Insomnia v4 and OpenAPI 3.0.3 files from the routes Axil Studio discovers, then download, copy or preview them.

3 min readUpdated DocumentationEdit this page
On this page7

The Export view (#/export, shortcut g x) turns the routes Studio discovered into ready-to-import API collections.

Export cards

There is one card per format, each showing the number of endpoints and the file name:

FormatFileImport it via
Postmanpostman-collection.jsonCollection v2.1 — File › Import in Postman
Insomniainsomnia-collection.jsonExport format v4 — Application › Import in Insomnia
OpenAPI 3.0openapi.jsonAny OpenAPI 3 tool: docs viewers, code generators, gateways

Each card has Download and Copy JSON. Both are disabled when no routes were found. The same downloads are available from the command palette (Download Postman collection, Download Insomnia collection, Download OpenAPI spec).

Preview

The Preview card has four tabs:

  • Endpoints: a table of every route with method, path (links to the request builder), handler and middleware tags.
  • Postman, Insomnia, OpenAPI: the generated JSON, highlighted.

Generated files are cached in the page; Refresh data clears the cache so the next export reflects new routes.

What each format contains

Postman (Collection v2.1)

  • info.name is <app name> API.
  • One folder per first path segment (/users, /orders, ...), one request per route named METHOD /path.
  • Headers: Content-Type: application/json and a disabled Authorization: Bearer {{token}}.
  • Path parameters become URL variables (:id with value {{id}}).
  • POST, PUT and PATCH requests get a sample raw JSON body chosen by path (users, auth / login, posts, otherwise {"key": "value"}).
  • Collection variables baseUrl (your app URL) and token (empty).

Insomnia (export format v4)

  • A workspace named <app name> API.
  • A Development environment with baseUrl and token.
  • One request per route, URL {{ _.baseUrl }}/path, with Content-Type: application/json and disabled Bearer authentication using {{ _.token }}.
  • POST, PUT and PATCH requests get the body {"key": "value"}.

OpenAPI 3.0.3

  • info.title is <app name> API, info.version is 1.0.0, and servers contains your app URL.
  • Paths use OpenAPI syntax (/users/:id becomes /users/{id}), one operation per route with summary METHOD /path.
  • Each operation is tagged with its first path segment.
  • Path parameters are listed as required strings.
  • POST, PUT and PATCH operations have a required application/json request body (generic object schema).
  • Responses: 200, 400, 404 and 500.

Note

The spec is generated from route paths only. It has no request or response schemas beyond generic objects and no security schemes, so treat it as a starting point.

API endpoints

The files come from Studio's HTTP API, so you can also fetch them from scripts while axil run is running:

Terminal
❯curl http://localhost:3001/api/studio/export/openapi -o openapi.json

See GET /api/studio/export/:format.

Was this page helpful?

Help improve the documentation

AxilJS is open source and documentation improvements are welcome.

AxilJS DocumentationMIT License · Built by SyntaxilitY