Utilo

OpenAPI to Mock & TypeScript

Paste an OpenAPI 3 or Swagger 2 spec (JSON or YAML) to generate realistic mock responses, TypeScript interfaces and a typed fetch client for every endpoint — entirely in your browser.

What this OpenAPI tool does

Frontend work often starts before the backend is ready, and hand-writing types for an API that already has a spec is wasted effort. Paste an OpenAPI 3.x or Swagger 2.0 document in JSON or YAML and this tool generates three things: realistic mock responses for every operation, TypeScript types for all schemas, and a small typed fetch client with one function per endpoint. Everything is generated in your browser, so private or internal API specs are never uploaded.

How to use it

  1. Paste your spec or upload the file. Both JSON and YAML are accepted.
  2. The endpoint list shows every operation with its method and path.
  3. Open the mock data tab and select an operation to see a sample response, built from schema examples, formats and enums.
  4. Switch to TS types for interfaces generated from components/schemas (or definitions in Swagger 2).
  5. Switch to TS client for a ready-to-use client and copy it into your project.

How mocks are generated

  • example and examples values from the spec always win.
  • enum picks the first value; default is respected.
  • String formats produce plausible values: email, uuid, date-time, uri, ipv4 and so on.
  • Property names give hints, so name, price or createdAt look realistic.
  • $ref, allOf, oneOf and anyOf are resolved; recursive references are cut off safely.
  • Mocks are deterministic per operation, so they don't change on every refresh.

Using the generated client

The client exports a BASE_URL constant and one async function per operation, named after its operationId (or method and path when missing), with typed path parameters, query parameters and request body, returning the typed response. It only depends on fetch, so it works in browsers, Node 18+, Deno and Bun.

Frequently asked questions

Which spec versions are supported?

OpenAPI 3.0 and 3.1, plus Swagger 2.0. External $refs pointing to other files or URLs are not fetched; bundle your spec first (for example with redocly bundle).

Can I run a mock server from this?

This tool shows mock payloads you can copy into MSW handlers, fixtures or Storybook. For a running mock server, tools like Prism can use the same spec.

How does this compare to openapi-typescript?

For production codegen in a build pipeline, dedicated CLIs are great. This tool is for quick, no-install exploration and prototyping.

Is my spec uploaded?

No. Parsing and generation are fully local.

Yes. All processing happens directly in your browser using JavaScript, Web Workers and Web APIs. Nothing you type, paste or upload is sent to our servers.