Repository: pmcelhaney/counterfact
Pull request #169 (2022-08-22 21:36:41)

response type
- HttpStatusCode type
- response type coder
- add response type to operation arguments




Patch:
diff --git a/demo-ts/package.json b/demo-ts/package.json
index cd746d3..cdf6dd2 100644
--- a/demo-ts/package.json
+++ b/demo-ts/package.json
@@ -20,7 +20,7 @@
     "npm": "^8.13.1"
   },
   "scripts": {
-    "start": "ts-node index.ts",
+    "start": "ts-node -T index.ts",
     "test": "echo \"Error: no test specified\" && exit 1"
   },
   "author": "",
diff --git a/demo-ts/path-types/pet.types.ts b/demo-ts/path-types/pet.types.ts
index 6231b46..bdb3c12 100644
--- a/demo-ts/path-types/pet.types.ts
+++ b/demo-ts/path-types/pet.types.ts
@@ -1,4 +1,6 @@
 import type { Context } from "../context/context.js";
+import type { ResponseBuilderBuilder } from "counterfact";
+import type { HttpStatusCode } from "counterfact";
 import type { Pet } from "./../components/Pet.js";
 import type { Tools } from "./../internal/tools.js";
 export type HTTP_POST = ({
@@ -14,6 +16,23 @@ export type HTTP_POST = ({
   header: undefined;
   body: Pet;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    200: {
+      headers: {};
+      content: {
+        "application/xml": {
+          schema: Pet;
+        };
+        "application/json": {
+          schema: Pet;
+        };
+      };
+    };
+    405: {
+      headers: {};
+      content: {};
+    };
+  }>;
   tools: Tools;
 }) =>
   | {
@@ -29,7 +48,8 @@ export type HTTP_POST = ({
   | {
       status: 405;
     }
-  | { status: 415; contentType: "text/plain"; body: string };
+  | { status: 415; contentType: "text/plain"; body: string }
+  | void;
 export type HTTP_PUT = ({
   query,
   path,
@@ -43,6 +63,31 @@ export type HTTP_PUT = ({
   header: undefined;
   body: Pet;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    200: {
+      headers: {};
+      content: {
+        "application/xml": {
+          schema: Pet;
+        };
+        "application/json": {
+          schema: Pet;
+        };
+      };
+    };
+    400: {
+      headers: {};
+      content: {};
+    };
+    404: {
+      headers: {};
+      content: {};
+    };
+    405: {
+      headers: {};
+      content: {};
+    };
+  }>;
   tools: Tools;
 }) =>
   | {
@@ -64,4 +109,5 @@ export type HTTP_PUT = ({
   | {
       status: 405;
     }
-  | { status: 415; contentType: "text/plain"; body: string };
+  | { status: 415; contentType: "text/plain"; body: string }
+  | void;
diff --git a/demo-ts/path-types/pet/findByStatus.types.ts b/demo-ts/path-types/pet/findByStatus.types.ts
index d5ff8bf..f7e059d 100644
--- a/demo-ts/path-types/pet/findByStatus.types.ts
+++ b/demo-ts/path-types/pet/findByStatus.types.ts
@@ -1,6 +1,8 @@
 import type { Context } from "../../context/context.js";
-import type { Tools } from "./../../internal/tools.js";
+import type { ResponseBuilderBuilder } from "counterfact";
+import type { HttpStatusCode } from "counterfact";
 import type { Pet } from "./../../components/Pet.js";
+import type { Tools } from "./../../internal/tools.js";
 export type HTTP_GET = ({
   query,
   path,
@@ -14,6 +16,23 @@ export type HTTP_GET = ({
   header: never;
   body: undefined;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    200: {
+      headers: {};
+      content: {
+        "application/xml": {
+          schema: Array<Pet>;
+        };
+        "application/json": {
+          schema: Array<Pet>;
+        };
+      };
+    };
+    400: {
+      headers: {};
+      content: {};
+    };
+  }>;
   tools: Tools;
 }) =>
   | {
@@ -29,4 +48,5 @@ export type HTTP_GET = ({
   | {
       status: 400;
     }
-  | { status: 415; contentType: "text/plain"; body: string };
+  | { status: 415; contentType: "text/plain"; body: string }
+  | void;
diff --git a/demo-ts/path-types/pet/findByTags.types.ts b/demo-ts/path-types/pet/findByTags.types.ts
index 85a1f30..4e5a051 100644
--- a/demo-ts/path-types/pet/findByTags.types.ts
+++ b/demo-ts/path-types/pet/findByTags.types.ts
@@ -1,6 +1,8 @@
 import type { Context } from "../../context/context.js";
-import type { Tools } from "./../../internal/tools.js";
+import type { ResponseBuilderBuilder } from "counterfact";
+import type { HttpStatusCode } from "counterfact";
 import type { Pet } from "./../../components/Pet.js";
+import type { Tools } from "./../../internal/tools.js";
 export type HTTP_GET = ({
   query,
   path,
@@ -14,6 +16,23 @@ export type HTTP_GET = ({
   header: never;
   body: undefined;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    200: {
+      headers: {};
+      content: {
+        "application/xml": {
+          schema: Array<Pet>;
+        };
+        "application/json": {
+          schema: Array<Pet>;
+        };
+      };
+    };
+    400: {
+      headers: {};
+      content: {};
+    };
+  }>;
   tools: Tools;
 }) =>
   | {
@@ -29,4 +48,5 @@ export type HTTP_GET = ({
   | {
       status: 400;
     }
-  | { status: 415; contentType: "text/plain"; body: string };
+  | { status: 415; contentType: "text/plain"; body: string }
+  | void;
diff --git a/demo-ts/path-types/pet/{petId}.types.ts b/demo-ts/path-types/pet/{petId}.types.ts
index 308bb8b..be2772f 100644
--- a/demo-ts/path-types/pet/{petId}.types.ts
+++ b/demo-ts/path-types/pet/{petId}.types.ts
@@ -1,6 +1,8 @@
 import type { Context } from "../../context/context.js";
-import type { Tools } from "./../../internal/tools.js";
+import type { ResponseBuilderBuilder } from "counterfact";
+import type { HttpStatusCode } from "counterfact";
 import type { Pet } from "./../../components/Pet.js";
+import type { Tools } from "./../../internal/tools.js";
 export type HTTP_GET = ({
   query,
   path,
@@ -14,6 +16,27 @@ export type HTTP_GET = ({
   header: never;
   body: undefined;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    200: {
+      headers: {};
+      content: {
+        "application/xml": {
+          schema: Pet;
+        };
+        "application/json": {
+          schema: Pet;
+        };
+      };
+    };
+    400: {
+      headers: {};
+      content: {};
+    };
+    404: {
+      headers: {};
+      content: {};
+    };
+  }>;
   tools: Tools;
 }) =>
   | {
@@ -32,7 +55,8 @@ export type HTTP_GET = ({
   | {
       status: 404;
     }
-  | { status: 415; contentType: "text/plain"; body: string };
+  | { status: 415; contentType: "text/plain"; body: string }
+  | void;
 export type HTTP_POST = ({
   query,
   path,
@@ -46,12 +70,19 @@ export type HTTP_POST = ({
   header: never;
   body: undefined;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    405: {
+      headers: {};
+      content: {};
+    };
+  }>;
   tools: Tools;
 }) =>
   | {
       status: 405;
     }
-  | { status: 415; contentType: "text/plain"; body: string };
+  | { status: 415; contentType: "text/plain"; body: string }
+  | void;
 export type HTTP_DELETE = ({
   query,
   path,
@@ -65,9 +96,16 @@ export type HTTP_DELETE = ({
   header: { api_key?: string };
   body: undefined;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    400: {
+      headers: {};
+      content: {};
+    };
+  }>;
   tools: Tools;
 }) =>
   | {
       status: 400;
     }
-  | { status: 415; contentType: "text/plain"; body: string };
+  | { status: 415; contentType: "text/plain"; body: string }
+  | void;
diff --git a/demo-ts/path-types/pet/{petId}/uploadImage.types.ts b/demo-ts/path-types/pet/{petId}/uploadImage.types.ts
index f24a84f..aae6b24 100644
--- a/demo-ts/path-types/pet/{petId}/uploadImage.types.ts
+++ b/demo-ts/path-types/pet/{petId}/uploadImage.types.ts
@@ -1,6 +1,8 @@
 import type { Context } from "../../../context/context.js";
-import type { Tools } from "./../../../internal/tools.js";
+import type { ResponseBuilderBuilder } from "counterfact";
+import type { HttpStatusCode } from "counterfact";
 import type { ApiResponse } from "./../../../components/ApiResponse.js";
+import type { Tools } from "./../../../internal/tools.js";
 export type HTTP_POST = ({
   query,
   path,
@@ -14,6 +16,16 @@ export type HTTP_POST = ({
   header: never;
   body: undefined;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    200: {
+      headers: {};
+      content: {
+        "application/json": {
+          schema: ApiResponse;
+        };
+      };
+    };
+  }>;
   tools: Tools;
 }) =>
   | {
@@ -21,4 +33,5 @@ export type HTTP_POST = ({
       contentType?: "application/json";
       body?: ApiResponse;
     }
-  | { status: 415; contentType: "text/plain"; body: string };
+  | { status: 415; contentType: "text/plain"; body: string }
+  | void;
diff --git a/demo-ts/path-types/store/inventory.types.ts b/demo-ts/path-types/store/inventory.types.ts
index 0f6bfa8..7c4ff3c 100644
--- a/demo-ts/path-types/store/inventory.types.ts
+++ b/demo-ts/path-types/store/inventory.types.ts
@@ -1,4 +1,6 @@
 import type { Context } from "../../context/context.js";
+import type { ResponseBuilderBuilder } from "counterfact";
+import type { HttpStatusCode } from "counterfact";
 import type { Tools } from "./../../internal/tools.js";
 export type HTTP_GET = ({
   query,
@@ -13,11 +15,22 @@ export type HTTP_GET = ({
   header: undefined;
   body: undefined;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    200: {
+      headers: {};
+      content: {
+        "application/json": {
+          schema: { [key: string]: number };
+        };
+      };
+    };
+  }>;
   tools: Tools;
 }) =>
   | {
       status: 200;
       contentType?: "application/json";
-      body?: {};
+      body?: { [key: string]: number };
     }
-  | { status: 415; contentType: "text/plain"; body: string };
+  | { status: 415; contentType: "text/plain"; body: string }
+  | void;
diff --git a/demo-ts/path-types/store/order.types.ts b/demo-ts/path-types/store/order.types.ts
index 1b622d0..94ec6a3 100644
--- a/demo-ts/path-types/store/order.types.ts
+++ b/demo-ts/path-types/store/order.types.ts
@@ -1,4 +1,6 @@
 import type { Context } from "../../context/context.js";
+import type { ResponseBuilderBuilder } from "counterfact";
+import type { HttpStatusCode } from "counterfact";
 import type { Order } from "./../../components/Order.js";
 import type { Tools } from "./../../internal/tools.js";
 export type HTTP_POST = ({
@@ -14,6 +16,20 @@ export type HTTP_POST = ({
   header: undefined;
   body: Order;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    200: {
+      headers: {};
+      content: {
+        "application/json": {
+          schema: Order;
+        };
+      };
+    };
+    405: {
+      headers: {};
+      content: {};
+    };
+  }>;
   tools: Tools;
 }) =>
   | {
@@ -24,4 +40,5 @@ export type HTTP_POST = ({
   | {
       status: 405;
     }
-  | { status: 415; contentType: "text/plain"; body: string };
+  | { status: 415; contentType: "text/plain"; body: string }
+  | void;
diff --git a/demo-ts/path-types/store/order/{orderId}.types.ts b/demo-ts/path-types/store/order/{orderId}.types.ts
index af28a56..a578fa2 100644
--- a/demo-ts/path-types/store/order/{orderId}.types.ts
+++ b/demo-ts/path-types/store/order/{orderId}.types.ts
@@ -1,6 +1,8 @@
 import type { Context } from "../../../context/context.js";
-import type { Tools } from "./../../../internal/tools.js";
+import type { ResponseBuilderBuilder } from "counterfact";
+import type { HttpStatusCode } from "counterfact";
 import type { Order } from "./../../../components/Order.js";
+import type { Tools } from "./../../../internal/tools.js";
 export type HTTP_GET = ({
   query,
   path,
@@ -14,6 +16,27 @@ export type HTTP_GET = ({
   header: never;
   body: undefined;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    200: {
+      headers: {};
+      content: {
+        "application/xml": {
+          schema: Order;
+        };
+        "application/json": {
+          schema: Order;
+        };
+      };
+    };
+    400: {
+      headers: {};
+      content: {};
+    };
+    404: {
+      headers: {};
+      content: {};
+    };
+  }>;
   tools: Tools;
 }) =>
   | {
@@ -32,7 +55,8 @@ export type HTTP_GET = ({
   | {
       status: 404;
     }
-  | { status: 415; contentType: "text/plain"; body: string };
+  | { status: 415; contentType: "text/plain"; body: string }
+  | void;
 export type HTTP_DELETE = ({
   query,
   path,
@@ -46,6 +70,16 @@ export type HTTP_DELETE = ({
   header: never;
   body: undefined;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    400: {
+      headers: {};
+      content: {};
+    };
+    404: {
+      headers: {};
+      content: {};
+    };
+  }>;
   tools: Tools;
 }) =>
   | {
@@ -54,4 +88,5 @@ export type HTTP_DELETE = ({
   | {
       status: 404;
     }
-  | { status: 415; contentType: "text/plain"; body: string };
+  | { status: 415; contentType: "text/plain"; body: string }
+  | void;
diff --git a/demo-ts/path-types/user.types.ts b/demo-ts/path-types/user.types.ts
index b44f1a6..463dcad 100644
--- a/demo-ts/path-types/user.types.ts
+++ b/demo-ts/path-types/user.types.ts
@@ -1,4 +1,6 @@
 import type { Context } from "../context/context.js";
+import type { ResponseBuilderBuilder } from "counterfact";
+import type { HttpStatusCode } from "counterfact";
 import type { User } from "./../components/User.js";
 import type { Tools } from "./../internal/tools.js";
 export type HTTP_POST = ({
@@ -14,6 +16,19 @@ export type HTTP_POST = ({
   header: undefined;
   body: User;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    [statusCode in HttpStatusCode]: {
+      headers: {};
+      content: {
+        "application/json": {
+          schema: User;
+        };
+        "application/xml": {
+          schema: User;
+        };
+      };
+    };
+  }>;
   tools: Tools;
 }) =>
   | {
@@ -26,4 +41,5 @@ export type HTTP_POST = ({
       contentType?: "application/xml";
       body?: User;
     }
-  | { status: 415; contentType: "text/plain"; body: string };
+  | { status: 415; contentType: "text/plain"; body: string }
+  | void;
diff --git a/demo-ts/path-types/user/createWithList.types.ts b/demo-ts/path-types/user/createWithList.types.ts
index d73fbf2..5331838 100644
--- a/demo-ts/path-types/user/createWithList.types.ts
+++ b/demo-ts/path-types/user/createWithList.types.ts
@@ -1,4 +1,6 @@
 import type { Context } from "../../context/context.js";
+import type { ResponseBuilderBuilder } from "counterfact";
+import type { HttpStatusCode } from "counterfact";
 import type { User } from "./../../components/User.js";
 import type { Tools } from "./../../internal/tools.js";
 export type HTTP_POST = ({
@@ -14,6 +16,23 @@ export type HTTP_POST = ({
   header: undefined;
   body: Array<User>;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    200: {
+      headers: {};
+      content: {
+        "application/xml": {
+          schema: User;
+        };
+        "application/json": {
+          schema: User;
+        };
+      };
+    };
+    [statusCode in Exclude<HttpStatusCode, 200>]: {
+      headers: {};
+      content: {};
+    };
+  }>;
   tools: Tools;
 }) =>
   | {
@@ -29,4 +48,5 @@ export type HTTP_POST = ({
   | {
       status: number | undefined;
     }
-  | { status: 415; contentType: "text/plain"; body: string };
+  | { status: 415; contentType: "text/plain"; body: string }
+  | void;
diff --git a/demo-ts/path-types/user/login.types.ts b/demo-ts/path-types/user/login.types.ts
index 104c4ee..0e7a062 100644
--- a/demo-ts/path-types/user/login.types.ts
+++ b/demo-ts/path-types/user/login.types.ts
@@ -1,4 +1,6 @@
 import type { Context } from "../../context/context.js";
+import type { ResponseBuilderBuilder } from "counterfact";
+import type { HttpStatusCode } from "counterfact";
 import type { Tools } from "./../../internal/tools.js";
 export type HTTP_GET = ({
   query,
@@ -13,6 +15,23 @@ export type HTTP_GET = ({
   header: never;
   body: undefined;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    200: {
+      headers: {};
+      content: {
+        "application/xml": {
+          schema: string;
+        };
+        "application/json": {
+          schema: string;
+        };
+      };
+    };
+    400: {
+      headers: {};
+      content: {};
+    };
+  }>;
   tools: Tools;
 }) =>
   | {
@@ -28,4 +47,5 @@ export type HTTP_GET = ({
   | {
       status: 400;
     }
-  | { status: 415; contentType: "text/plain"; body: string };
+  | { status: 415; contentType: "text/plain"; body: string }
+  | void;
diff --git a/demo-ts/path-types/user/logout.types.ts b/demo-ts/path-types/user/logout.types.ts
index 6bc3ee4..ccc7f00 100644
--- a/demo-ts/path-types/user/logout.types.ts
+++ b/demo-ts/path-types/user/logout.types.ts
@@ -1,4 +1,6 @@
 import type { Context } from "../../context/context.js";
+import type { ResponseBuilderBuilder } from "counterfact";
+import type { HttpStatusCode } from "counterfact";
 import type { Tools } from "./../../internal/tools.js";
 export type HTTP_GET = ({
   query,
@@ -13,9 +15,16 @@ export type HTTP_GET = ({
   header: never;
   body: undefined;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    [statusCode in HttpStatusCode]: {
+      headers: {};
+      content: {};
+    };
+  }>;
   tools: Tools;
 }) =>
   | {
       status: number | undefined;
     }
-  | { status: 415; contentType: "text/plain"; body: string };
+  | { status: 415; contentType: "text/plain"; body: string }
+  | void;
diff --git a/demo-ts/path-types/user/{username}.types.ts b/demo-ts/path-types/user/{username}.types.ts
index 71a8642..b8b599b 100644
--- a/demo-ts/path-types/user/{username}.types.ts
+++ b/demo-ts/path-types/user/{username}.types.ts
@@ -1,6 +1,8 @@
 import type { Context } from "../../context/context.js";
-import type { Tools } from "./../../internal/tools.js";
+import type { ResponseBuilderBuilder } from "counterfact";
+import type { HttpStatusCode } from "counterfact";
 import type { User } from "./../../components/User.js";
+import type { Tools } from "./../../internal/tools.js";
 export type HTTP_GET = ({
   query,
   path,
@@ -14,6 +16,27 @@ export type HTTP_GET = ({
   header: never;
   body: undefined;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    200: {
+      headers: {};
+      content: {
+        "application/xml": {
+          schema: User;
+        };
+        "application/json": {
+          schema: User;
+        };
+      };
+    };
+    400: {
+      headers: {};
+      content: {};
+    };
+    404: {
+      headers: {};
+      content: {};
+    };
+  }>;
   tools: Tools;
 }) =>
   | {
@@ -32,7 +55,8 @@ export type HTTP_GET = ({
   | {
       status: 404;
     }
-  | { status: 415; contentType: "text/plain"; body: string };
+  | { status: 415; contentType: "text/plain"; body: string }
+  | void;
 export type HTTP_PUT = ({
   query,
   path,
@@ -46,12 +70,19 @@ export type HTTP_PUT = ({
   header: never;
   body: User;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    [statusCode in HttpStatusCode]: {
+      headers: {};
+      content: {};
+    };
+  }>;
   tools: Tools;
 }) =>
   | {
       status: number | undefined;
     }
-  | { status: 415; contentType: "text/plain"; body: string };
+  | { status: 415; contentType: "text/plain"; body: string }
+  | void;
 export type HTTP_DELETE = ({
   query,
   path,
@@ -65,6 +96,16 @@ export type HTTP_DELETE = ({
   header: never;
   body: undefined;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    400: {
+      headers: {};
+      content: {};
+    };
+    404: {
+      headers: {};
+      content: {};
+    };
+  }>;
   tools: Tools;
 }) =>
   | {
@@ -73,4 +114,5 @@ export type HTTP_DELETE = ({
   | {
       status: 404;
     }
-  | { status: 415; contentType: "text/plain"; body: string };
+  | { status: 415; contentType: "text/plain"; body: string }
+  | void;
diff --git a/demo-ts/paths/store/inventory.ts b/demo-ts/paths/store/inventory.ts
index 6f8311c..874a6e4 100644
--- a/demo-ts/paths/store/inventory.ts
+++ b/demo-ts/paths/store/inventory.ts
@@ -1,24 +1,4 @@
 import type { HTTP_GET } from "./../../path-types/store/inventory.types.js";
-export const GET: HTTP_GET = ({ context, tools }) => {
-  const statusCode = tools.oneOf(["200"]);
-
-  if (statusCode === "200") {
-    if (tools.accepts("application/json")) {
-      return {
-        status: 200,
-        contentType: "application/json",
-        body: tools.randomFromSchema({
-          type: "object",
-          required: [],
-          properties: {},
-        }) as {},
-      };
-    }
-  }
-
-  return {
-    status: 415,
-    contentType: "text/plain",
-    body: "HTTP 415: Unsupported Media Type",
-  };
+export const GET: HTTP_GET = ({ response }) => { 
+  return response[200].json({"ok": 1})
 };
diff --git a/src/counterfact.d.ts b/src/counterfact.d.ts
index 56820ed..8b79efd 100644
--- a/src/counterfact.d.ts
+++ b/src/counterfact.d.ts
@@ -1,3 +1,5 @@
+export type HttpStatusCode = 100 | 101 | 102 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 226 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 422 | 423 | 424 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 511;
+
 type StatusCodeWithDescription = `${number}${string}`;
 
 type OpenApiHeader = {
@@ -28,6 +30,7 @@ type CounterfactResponse = {
   status: number;
   headers: Record<string, string | number>;
   content: Array<{ type: MediaType; body: unknown }>;
+  isCounterfactResponse: true;
 };
 
 type IfHasKey<R, Key, Yes, No> = Key extends keyof R ? Yes : No;
@@ -68,7 +71,7 @@ type HeaderFunction<Response extends OpenApiResponse> = <
 type ResponseBuilder<Response extends OpenApiResponse> = [
   keyof Response["content"]
 ] extends [never]
-  ? CounterfactResponse
+  ? void
   : OmitValueWhenNever<{
       header: [keyof Response["headers"]] extends [never]
         ? never
@@ -81,7 +84,7 @@ type ResponseBuilder<Response extends OpenApiResponse> = [
       html: MaybeShortcut<"text/html", Response>;
       random: [keyof Response["content"]] extends [never]
         ? never
-        : () => CounterfactResponse;
+        : () => void;
     }>;
 
 export type ResponseBuilderBuilder<Responses extends OpenApiResponses> = {
diff --git a/src/typescript-generator/operation-type-coder.js b/src/typescript-generator/operation-type-coder.js
index 9773f5c..badd0d6 100644
--- a/src/typescript-generator/operation-type-coder.js
+++ b/src/typescript-generator/operation-type-coder.js
@@ -4,6 +4,7 @@ import { Coder } from "./coder.js";
 import { ToolsCoder } from "./tools-coder.js";
 import { SchemaTypeCoder } from "./schema-type-coder.js";
 import { ParametersTypeCoder } from "./parameters-type-coder.js";
+import { ResponseTypeCoder } from "./response-type-coder.js";
 
 export class OperationTypeCoder extends Coder {
   names() {
@@ -95,11 +96,16 @@ export class OperationTypeCoder extends Coder {
       ? new SchemaTypeCoder(bodyRequirement).write(script)
       : "undefined";
 
-    return `({ query, path, header, body, context, tools }: { query: ${queryType}, path: ${pathType}, header: ${headerType}, body: ${bodyType}, context: Context, tools: ${script.importType(
+    const responseType = new ResponseTypeCoder(
+      this.requirement.select("responses")
+    ).write(script);
+
+    return `({ query, path, header, body, context, tools }: { query: ${queryType}, path: ${pathType}, header: ${headerType}, body: ${bodyType}, context: Context, response: ${responseType}, tools: ${script.importType(
       new ToolsCoder(),
       "internal/tools.ts"
     )}}) => ${this.responseTypes(
       script
-    )} | { status: 415, contentType: "text/plain", body: string }`;
+    )} | { status: 415, contentType: "text/plain", body: string }
+    | void`;
   }
 }
diff --git a/src/typescript-generator/response-type-coder.js b/src/typescript-generator/response-type-coder.js
new file mode 100644
index 0000000..6739bae
--- /dev/null
+++ b/src/typescript-generator/response-type-coder.js
@@ -0,0 +1,70 @@
+import { Coder } from "./coder.js";
+import { SchemaTypeCoder } from "./schema-type-coder.js";
+
+export class ResponseTypeCoder extends Coder {
+  normalizeStatusCode(statusCode, responses) {
+    const definedStatusCodes = Object.keys(responses).filter(
+      (key) => key !== "default"
+    );
+
+    if (statusCode === "default") {
+      if (definedStatusCodes.length === 0) {
+        return "[statusCode in HttpStatusCode]";
+      }
+
+      return `[statusCode in Exclude<HttpStatusCode, ${definedStatusCodes.join(
+        " | "
+      )}>]`;
+    }
+
+    return statusCode;
+  }
+
+  buildContentObjectType(script, statusCode, response) {
+    return `{
+      ${Object.keys(response.content ?? {})
+        .map(
+          (mediaType) =>
+            `"${mediaType}": { 
+              schema:  ${new SchemaTypeCoder(
+                this.requirement
+                  .select(statusCode)
+                  .select("content")
+                  .select(mediaType.replace("/", "~1"))
+                  .select("schema")
+              ).write(script)}
+            }`
+        )
+        .join(",\n")}
+    }`;
+  }
+
+  buildResponseObjectType(script) {
+    const responses = this.requirement.data;
+
+    return `{
+      ${Object.entries(responses)
+        .map(
+          ([responseCode, response]) => `${this.normalizeStatusCode(
+            responseCode,
+            responses
+          )}: {
+          headers: {};
+          content: ${this.buildContentObjectType(
+            script,
+            responseCode,
+            response
+          )};
+        }`
+        )
+        .join(",")}
+      }`;
+  }
+
+  write(script) {
+    script.importExternalType("ResponseBuilderBuilder", "counterfact");
+    script.importExternalType("HttpStatusCode", "counterfact");
+
+    return `ResponseBuilderBuilder<${this.buildResponseObjectType(script)}>`;
+  }
+}


Test patch:
diff --git a/test/typescript-generator/__snapshots__/end-to-end.test.js.snap b/test/typescript-generator/__snapshots__/end-to-end.test.js.snap
index f108f2f..cea8cf6 100644
--- a/test/typescript-generator/__snapshots__/end-to-end.test.js.snap
+++ b/test/typescript-generator/__snapshots__/end-to-end.test.js.snap
@@ -139,7 +139,24 @@ if (statusCode === \\"405\\") {
           },
           "exports": Map {
             "HTTP_POST" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: Pet, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: Pet, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  Pet
+            },
+\\"application/json\\": { 
+              schema:  Pet
+            }
+    };
+        },405: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: Pet
@@ -154,7 +171,8 @@ if (statusCode === \\"405\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet/post",
               "isType": true,
@@ -163,7 +181,34 @@ if (statusCode === \\"405\\") {
               "typeDeclaration": "",
             },
             "HTTP_PUT" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: Pet, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: Pet, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  Pet
+            },
+\\"application/json\\": { 
+              schema:  Pet
+            }
+    };
+        },400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        },405: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: Pet
@@ -188,7 +233,8 @@ if (statusCode === \\"405\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet/put",
               "isType": true,
@@ -202,6 +248,14 @@ if (statusCode === \\"405\\") {
               "isType": true,
               "modulePath": "../context/context.js",
             },
+            "ResponseBuilderBuilder" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
+            "HttpStatusCode" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
           },
           "imports": Map {
             "Pet" => Object {
@@ -519,7 +573,24 @@ if (statusCode === \\"405\\") {
           },
           "exports": Map {
             "HTTP_POST" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: Pet, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: Pet, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  Pet
+            },
+\\"application/json\\": { 
+              schema:  Pet
+            }
+    };
+        },405: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: Pet
@@ -534,7 +605,8 @@ if (statusCode === \\"405\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet/post",
               "isType": true,
@@ -543,7 +615,34 @@ if (statusCode === \\"405\\") {
               "typeDeclaration": "",
             },
             "HTTP_PUT" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: Pet, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: Pet, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  Pet
+            },
+\\"application/json\\": { 
+              schema:  Pet
+            }
+    };
+        },400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        },405: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: Pet
@@ -568,7 +667,8 @@ if (statusCode === \\"405\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet/put",
               "isType": true,
@@ -582,6 +682,14 @@ if (statusCode === \\"405\\") {
               "isType": true,
               "modulePath": "../context/context.js",
             },
+            "ResponseBuilderBuilder" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
+            "HttpStatusCode" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
           },
           "imports": Map {
             "Pet" => Object {
@@ -1416,7 +1524,24 @@ if (statusCode === \\"405\\") {
     },
     "exports": Map {
       "HTTP_POST" => Object {
-        "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: Pet, context: Context, tools: Tools}) => {  
+        "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: Pet, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  Pet
+            },
+\\"application/json\\": { 
+              schema:  Pet
+            }
+    };
+        },405: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: Pet
@@ -1431,7 +1556,8 @@ if (statusCode === \\"405\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
         "done": true,
         "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet/post",
         "isType": true,
@@ -1440,7 +1566,34 @@ if (statusCode === \\"405\\") {
         "typeDeclaration": "",
       },
       "HTTP_PUT" => Object {
-        "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: Pet, context: Context, tools: Tools}) => {  
+        "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: Pet, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  Pet
+            },
+\\"application/json\\": { 
+              schema:  Pet
+            }
+    };
+        },400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        },405: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: Pet
@@ -1465,7 +1618,8 @@ if (statusCode === \\"405\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
         "done": true,
         "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet/put",
         "isType": true,
@@ -1479,6 +1633,14 @@ if (statusCode === \\"405\\") {
         "isType": true,
         "modulePath": "../context/context.js",
       },
+      "ResponseBuilderBuilder" => Object {
+        "isType": true,
+        "modulePath": "counterfact",
+      },
+      "HttpStatusCode" => Object {
+        "isType": true,
+        "modulePath": "counterfact",
+      },
     },
     "imports": Map {
       "Pet" => Object {
@@ -1857,12 +2019,29 @@ if (statusCode === \\"400\\") {
         "script": Script {
           "cache": Map {
             "OperationTypeCoder@petstore.yaml#/paths/~1pet~1findByStatus/get@[object Object]:true" => "HTTP_GET",
-            "tools@internal/tools.ts:true" => "Tools",
             "SchemaTypeCoder@undefined@components/Pet.ts:true" => "Pet",
+            "tools@internal/tools.ts:true" => "Tools",
           },
           "exports": Map {
             "HTTP_GET" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: {status?: string}, path: never, header: never, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: {status?: string}, path: never, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  Array<Pet>
+            },
+\\"application/json\\": { 
+              schema:  Array<Pet>
+            }
+    };
+        },400: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: Array<Pet>
@@ -1877,7 +2056,8 @@ if (statusCode === \\"400\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet~1findByStatus/get",
               "isType": true,
@@ -1891,46 +2071,16 @@ if (statusCode === \\"400\\") {
               "isType": true,
               "modulePath": "../../context/context.js",
             },
-          },
-          "imports": Map {
-            "Tools" => Object {
+            "ResponseBuilderBuilder" => Object {
               "isType": true,
-              "name": "Tools",
-              "script": Script {
-                "cache": Map {
-                  "tools@[object Object]:true" => "Tools",
-                },
-                "exports": Map {
-                  "Tools" => Object {
-                    "code": "
-    {
-        oneOf: (array: string[]) => string;
-        randomFromSchema: (schema: JSONSchema6 ) => unknown;
-        accepts: (contentType: string) => boolean;
-    }",
-                    "done": true,
-                    "id": "tools",
-                    "isType": true,
-                    "name": "Tools",
-                    "promise": Promise {},
-                    "typeDeclaration": "",
-                  },
-                },
-                "externalImports": Map {
-                  "JSONSchema6" => Object {
-                    "isType": false,
-                    "modulePath": "json-schema",
-                  },
-                },
-                "imports": Map {},
-                "path": "internal/tools.ts",
-                "repository": Repository {
-                  "scripts": [Circular],
-                  "writeFiles": [Function],
-                },
-                "typeCache": Map {},
-              },
+              "modulePath": "counterfact",
+            },
+            "HttpStatusCode" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
             },
+          },
+          "imports": Map {
             "Pet" => Object {
               "isType": true,
               "name": "Pet",
@@ -2187,6 +2337,44 @@ if (statusCode === \\"400\\") {
                 "typeCache": Map {},
               },
             },
+            "Tools" => Object {
+              "isType": true,
+              "name": "Tools",
+              "script": Script {
+                "cache": Map {
+                  "tools@[object Object]:true" => "Tools",
+                },
+                "exports": Map {
+                  "Tools" => Object {
+                    "code": "
+    {
+        oneOf: (array: string[]) => string;
+        randomFromSchema: (schema: JSONSchema6 ) => unknown;
+        accepts: (contentType: string) => boolean;
+    }",
+                    "done": true,
+                    "id": "tools",
+                    "isType": true,
+                    "name": "Tools",
+                    "promise": Promise {},
+                    "typeDeclaration": "",
+                  },
+                },
+                "externalImports": Map {
+                  "JSONSchema6" => Object {
+                    "isType": false,
+                    "modulePath": "json-schema",
+                  },
+                },
+                "imports": Map {},
+                "path": "internal/tools.ts",
+                "repository": Repository {
+                  "scripts": [Circular],
+                  "writeFiles": [Function],
+                },
+                "typeCache": Map {},
+              },
+            },
           },
           "path": "path-types/pet/findByStatus.types.ts",
           "repository": Repository {
@@ -2719,12 +2907,29 @@ if (statusCode === \\"400\\") {
   "path-types/pet/findByStatus.types.ts" => Script {
     "cache": Map {
       "OperationTypeCoder@petstore.yaml#/paths/~1pet~1findByStatus/get@[object Object]:true" => "HTTP_GET",
-      "tools@internal/tools.ts:true" => "Tools",
       "SchemaTypeCoder@undefined@components/Pet.ts:true" => "Pet",
+      "tools@internal/tools.ts:true" => "Tools",
     },
     "exports": Map {
       "HTTP_GET" => Object {
-        "code": "({ query, path, header, body, context, tools }: { query: {status?: string}, path: never, header: never, body: undefined, context: Context, tools: Tools}) => {  
+        "code": "({ query, path, header, body, context, tools }: { query: {status?: string}, path: never, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  Array<Pet>
+            },
+\\"application/json\\": { 
+              schema:  Array<Pet>
+            }
+    };
+        },400: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: Array<Pet>
@@ -2739,7 +2944,8 @@ if (statusCode === \\"400\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
         "done": true,
         "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet~1findByStatus/get",
         "isType": true,
@@ -2753,46 +2959,16 @@ if (statusCode === \\"400\\") {
         "isType": true,
         "modulePath": "../../context/context.js",
       },
-    },
-    "imports": Map {
-      "Tools" => Object {
+      "ResponseBuilderBuilder" => Object {
         "isType": true,
-        "name": "Tools",
-        "script": Script {
-          "cache": Map {
-            "tools@[object Object]:true" => "Tools",
-          },
-          "exports": Map {
-            "Tools" => Object {
-              "code": "
-    {
-        oneOf: (array: string[]) => string;
-        randomFromSchema: (schema: JSONSchema6 ) => unknown;
-        accepts: (contentType: string) => boolean;
-    }",
-              "done": true,
-              "id": "tools",
-              "isType": true,
-              "name": "Tools",
-              "promise": Promise {},
-              "typeDeclaration": "",
-            },
-          },
-          "externalImports": Map {
-            "JSONSchema6" => Object {
-              "isType": false,
-              "modulePath": "json-schema",
-            },
-          },
-          "imports": Map {},
-          "path": "internal/tools.ts",
-          "repository": Repository {
-            "scripts": [Circular],
-            "writeFiles": [Function],
-          },
-          "typeCache": Map {},
-        },
+        "modulePath": "counterfact",
       },
+      "HttpStatusCode" => Object {
+        "isType": true,
+        "modulePath": "counterfact",
+      },
+    },
+    "imports": Map {
       "Pet" => Object {
         "isType": true,
         "name": "Pet",
@@ -3049,6 +3225,44 @@ if (statusCode === \\"400\\") {
           "typeCache": Map {},
         },
       },
+      "Tools" => Object {
+        "isType": true,
+        "name": "Tools",
+        "script": Script {
+          "cache": Map {
+            "tools@[object Object]:true" => "Tools",
+          },
+          "exports": Map {
+            "Tools" => Object {
+              "code": "
+    {
+        oneOf: (array: string[]) => string;
+        randomFromSchema: (schema: JSONSchema6 ) => unknown;
+        accepts: (contentType: string) => boolean;
+    }",
+              "done": true,
+              "id": "tools",
+              "isType": true,
+              "name": "Tools",
+              "promise": Promise {},
+              "typeDeclaration": "",
+            },
+          },
+          "externalImports": Map {
+            "JSONSchema6" => Object {
+              "isType": false,
+              "modulePath": "json-schema",
+            },
+          },
+          "imports": Map {},
+          "path": "internal/tools.ts",
+          "repository": Repository {
+            "scripts": [Circular],
+            "writeFiles": [Function],
+          },
+          "typeCache": Map {},
+        },
+      },
     },
     "path": "path-types/pet/findByStatus.types.ts",
     "repository": Repository {
@@ -3131,12 +3345,29 @@ if (statusCode === \\"400\\") {
         "script": Script {
           "cache": Map {
             "OperationTypeCoder@petstore.yaml#/paths/~1pet~1findByTags/get@[object Object]:true" => "HTTP_GET",
-            "tools@internal/tools.ts:true" => "Tools",
             "SchemaTypeCoder@undefined@components/Pet.ts:true" => "Pet",
+            "tools@internal/tools.ts:true" => "Tools",
           },
           "exports": Map {
             "HTTP_GET" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: {tags?: Array<string>}, path: never, header: never, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: {tags?: Array<string>}, path: never, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  Array<Pet>
+            },
+\\"application/json\\": { 
+              schema:  Array<Pet>
+            }
+    };
+        },400: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: Array<Pet>
@@ -3151,7 +3382,8 @@ if (statusCode === \\"400\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet~1findByTags/get",
               "isType": true,
@@ -3165,46 +3397,16 @@ if (statusCode === \\"400\\") {
               "isType": true,
               "modulePath": "../../context/context.js",
             },
-          },
-          "imports": Map {
-            "Tools" => Object {
+            "ResponseBuilderBuilder" => Object {
               "isType": true,
-              "name": "Tools",
-              "script": Script {
-                "cache": Map {
-                  "tools@[object Object]:true" => "Tools",
-                },
-                "exports": Map {
-                  "Tools" => Object {
-                    "code": "
-    {
-        oneOf: (array: string[]) => string;
-        randomFromSchema: (schema: JSONSchema6 ) => unknown;
-        accepts: (contentType: string) => boolean;
-    }",
-                    "done": true,
-                    "id": "tools",
-                    "isType": true,
-                    "name": "Tools",
-                    "promise": Promise {},
-                    "typeDeclaration": "",
-                  },
-                },
-                "externalImports": Map {
-                  "JSONSchema6" => Object {
-                    "isType": false,
-                    "modulePath": "json-schema",
-                  },
-                },
-                "imports": Map {},
-                "path": "internal/tools.ts",
-                "repository": Repository {
-                  "scripts": [Circular],
-                  "writeFiles": [Function],
-                },
-                "typeCache": Map {},
-              },
+              "modulePath": "counterfact",
+            },
+            "HttpStatusCode" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
             },
+          },
+          "imports": Map {
             "Pet" => Object {
               "isType": true,
               "name": "Pet",
@@ -3461,27 +3663,65 @@ if (statusCode === \\"400\\") {
                 "typeCache": Map {},
               },
             },
-          },
-          "path": "path-types/pet/findByTags.types.ts",
-          "repository": Repository {
-            "scripts": [Circular],
-            "writeFiles": [Function],
-          },
-          "typeCache": Map {},
-        },
-      },
-      "Pet" => Object {
-        "isType": true,
-        "name": "Pet",
-        "script": Script {
-          "cache": Map {
-            "SchemaTypeCoder@undefined@[object Object]:true" => "Pet",
-            "SchemaCoder@undefined@[object Object]:false" => "PetSchema",
-            "SchemaTypeCoder@undefined@components/Category.ts:true" => "Category",
-            "SchemaTypeCoder@undefined@components/Tag.ts:true" => "Tag",
-            "SchemaCoder@undefined@components/Category.ts:false" => "CategorySchema",
-            "SchemaCoder@undefined@components/Tag.ts:false" => "TagSchema",
-          },
+            "Tools" => Object {
+              "isType": true,
+              "name": "Tools",
+              "script": Script {
+                "cache": Map {
+                  "tools@[object Object]:true" => "Tools",
+                },
+                "exports": Map {
+                  "Tools" => Object {
+                    "code": "
+    {
+        oneOf: (array: string[]) => string;
+        randomFromSchema: (schema: JSONSchema6 ) => unknown;
+        accepts: (contentType: string) => boolean;
+    }",
+                    "done": true,
+                    "id": "tools",
+                    "isType": true,
+                    "name": "Tools",
+                    "promise": Promise {},
+                    "typeDeclaration": "",
+                  },
+                },
+                "externalImports": Map {
+                  "JSONSchema6" => Object {
+                    "isType": false,
+                    "modulePath": "json-schema",
+                  },
+                },
+                "imports": Map {},
+                "path": "internal/tools.ts",
+                "repository": Repository {
+                  "scripts": [Circular],
+                  "writeFiles": [Function],
+                },
+                "typeCache": Map {},
+              },
+            },
+          },
+          "path": "path-types/pet/findByTags.types.ts",
+          "repository": Repository {
+            "scripts": [Circular],
+            "writeFiles": [Function],
+          },
+          "typeCache": Map {},
+        },
+      },
+      "Pet" => Object {
+        "isType": true,
+        "name": "Pet",
+        "script": Script {
+          "cache": Map {
+            "SchemaTypeCoder@undefined@[object Object]:true" => "Pet",
+            "SchemaCoder@undefined@[object Object]:false" => "PetSchema",
+            "SchemaTypeCoder@undefined@components/Category.ts:true" => "Category",
+            "SchemaTypeCoder@undefined@components/Tag.ts:true" => "Tag",
+            "SchemaCoder@undefined@components/Category.ts:false" => "CategorySchema",
+            "SchemaCoder@undefined@components/Tag.ts:false" => "TagSchema",
+          },
           "exports": Map {
             "Pet" => Object {
               "code": "{id: number,name: string,category: Category,photoUrls: Array<string>,tags: Array<Tag>,status: string}",
@@ -3993,12 +4233,29 @@ if (statusCode === \\"400\\") {
   "path-types/pet/findByTags.types.ts" => Script {
     "cache": Map {
       "OperationTypeCoder@petstore.yaml#/paths/~1pet~1findByTags/get@[object Object]:true" => "HTTP_GET",
-      "tools@internal/tools.ts:true" => "Tools",
       "SchemaTypeCoder@undefined@components/Pet.ts:true" => "Pet",
+      "tools@internal/tools.ts:true" => "Tools",
     },
     "exports": Map {
       "HTTP_GET" => Object {
-        "code": "({ query, path, header, body, context, tools }: { query: {tags?: Array<string>}, path: never, header: never, body: undefined, context: Context, tools: Tools}) => {  
+        "code": "({ query, path, header, body, context, tools }: { query: {tags?: Array<string>}, path: never, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  Array<Pet>
+            },
+\\"application/json\\": { 
+              schema:  Array<Pet>
+            }
+    };
+        },400: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: Array<Pet>
@@ -4013,7 +4270,8 @@ if (statusCode === \\"400\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
         "done": true,
         "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet~1findByTags/get",
         "isType": true,
@@ -4027,46 +4285,16 @@ if (statusCode === \\"400\\") {
         "isType": true,
         "modulePath": "../../context/context.js",
       },
-    },
-    "imports": Map {
-      "Tools" => Object {
+      "ResponseBuilderBuilder" => Object {
         "isType": true,
-        "name": "Tools",
-        "script": Script {
-          "cache": Map {
-            "tools@[object Object]:true" => "Tools",
-          },
-          "exports": Map {
-            "Tools" => Object {
-              "code": "
-    {
-        oneOf: (array: string[]) => string;
-        randomFromSchema: (schema: JSONSchema6 ) => unknown;
-        accepts: (contentType: string) => boolean;
-    }",
-              "done": true,
-              "id": "tools",
-              "isType": true,
-              "name": "Tools",
-              "promise": Promise {},
-              "typeDeclaration": "",
-            },
-          },
-          "externalImports": Map {
-            "JSONSchema6" => Object {
-              "isType": false,
-              "modulePath": "json-schema",
-            },
-          },
-          "imports": Map {},
-          "path": "internal/tools.ts",
-          "repository": Repository {
-            "scripts": [Circular],
-            "writeFiles": [Function],
-          },
-          "typeCache": Map {},
-        },
+        "modulePath": "counterfact",
       },
+      "HttpStatusCode" => Object {
+        "isType": true,
+        "modulePath": "counterfact",
+      },
+    },
+    "imports": Map {
       "Pet" => Object {
         "isType": true,
         "name": "Pet",
@@ -4323,6 +4551,44 @@ if (statusCode === \\"400\\") {
           "typeCache": Map {},
         },
       },
+      "Tools" => Object {
+        "isType": true,
+        "name": "Tools",
+        "script": Script {
+          "cache": Map {
+            "tools@[object Object]:true" => "Tools",
+          },
+          "exports": Map {
+            "Tools" => Object {
+              "code": "
+    {
+        oneOf: (array: string[]) => string;
+        randomFromSchema: (schema: JSONSchema6 ) => unknown;
+        accepts: (contentType: string) => boolean;
+    }",
+              "done": true,
+              "id": "tools",
+              "isType": true,
+              "name": "Tools",
+              "promise": Promise {},
+              "typeDeclaration": "",
+            },
+          },
+          "externalImports": Map {
+            "JSONSchema6" => Object {
+              "isType": false,
+              "modulePath": "json-schema",
+            },
+          },
+          "imports": Map {},
+          "path": "internal/tools.ts",
+          "repository": Repository {
+            "scripts": [Circular],
+            "writeFiles": [Function],
+          },
+          "typeCache": Map {},
+        },
+      },
     },
     "path": "path-types/pet/findByTags.types.ts",
     "repository": Repository {
@@ -4456,12 +4722,34 @@ if (statusCode === \\"404\\") {
             "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/get@[object Object]:true" => "HTTP_GET",
             "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/post@[object Object]:true" => "HTTP_POST",
             "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/delete@[object Object]:true" => "HTTP_DELETE",
-            "tools@internal/tools.ts:true" => "Tools",
             "SchemaTypeCoder@undefined@components/Pet.ts:true" => "Pet",
+            "tools@internal/tools.ts:true" => "Tools",
           },
           "exports": Map {
             "HTTP_GET" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: never, path: {petId: number}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: never, path: {petId: number}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  Pet
+            },
+\\"application/json\\": { 
+              schema:  Pet
+            }
+    };
+        },400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: Pet
@@ -4481,7 +4769,8 @@ if (statusCode === \\"404\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/get",
               "isType": true,
@@ -4490,12 +4779,20 @@ if (statusCode === \\"404\\") {
               "typeDeclaration": "",
             },
             "HTTP_POST" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: {name?: number, status?: string}, path: {petId: number}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: {name?: number, status?: string}, path: {petId: number}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      405: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 405, 
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/post",
               "isType": true,
@@ -4504,12 +4801,20 @@ if (statusCode === \\"404\\") {
               "typeDeclaration": "",
             },
             "HTTP_DELETE" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: never, path: {petId: string}, header: {api_key?: string}, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: never, path: {petId: string}, header: {api_key?: string}, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      400: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 400, 
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/delete",
               "isType": true,
@@ -4523,46 +4828,16 @@ if (statusCode === \\"404\\") {
               "isType": true,
               "modulePath": "../../context/context.js",
             },
-          },
-          "imports": Map {
-            "Tools" => Object {
+            "ResponseBuilderBuilder" => Object {
               "isType": true,
-              "name": "Tools",
-              "script": Script {
-                "cache": Map {
-                  "tools@[object Object]:true" => "Tools",
-                },
-                "exports": Map {
-                  "Tools" => Object {
-                    "code": "
-    {
-        oneOf: (array: string[]) => string;
-        randomFromSchema: (schema: JSONSchema6 ) => unknown;
-        accepts: (contentType: string) => boolean;
-    }",
-                    "done": true,
-                    "id": "tools",
-                    "isType": true,
-                    "name": "Tools",
-                    "promise": Promise {},
-                    "typeDeclaration": "",
-                  },
-                },
-                "externalImports": Map {
-                  "JSONSchema6" => Object {
-                    "isType": false,
-                    "modulePath": "json-schema",
-                  },
-                },
-                "imports": Map {},
-                "path": "internal/tools.ts",
-                "repository": Repository {
-                  "scripts": [Circular],
-                  "writeFiles": [Function],
-                },
-                "typeCache": Map {},
-              },
+              "modulePath": "counterfact",
+            },
+            "HttpStatusCode" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
             },
+          },
+          "imports": Map {
             "Pet" => Object {
               "isType": true,
               "name": "Pet",
@@ -4819,6 +5094,44 @@ if (statusCode === \\"404\\") {
                 "typeCache": Map {},
               },
             },
+            "Tools" => Object {
+              "isType": true,
+              "name": "Tools",
+              "script": Script {
+                "cache": Map {
+                  "tools@[object Object]:true" => "Tools",
+                },
+                "exports": Map {
+                  "Tools" => Object {
+                    "code": "
+    {
+        oneOf: (array: string[]) => string;
+        randomFromSchema: (schema: JSONSchema6 ) => unknown;
+        accepts: (contentType: string) => boolean;
+    }",
+                    "done": true,
+                    "id": "tools",
+                    "isType": true,
+                    "name": "Tools",
+                    "promise": Promise {},
+                    "typeDeclaration": "",
+                  },
+                },
+                "externalImports": Map {
+                  "JSONSchema6" => Object {
+                    "isType": false,
+                    "modulePath": "json-schema",
+                  },
+                },
+                "imports": Map {},
+                "path": "internal/tools.ts",
+                "repository": Repository {
+                  "scripts": [Circular],
+                  "writeFiles": [Function],
+                },
+                "typeCache": Map {},
+              },
+            },
           },
           "path": "path-types/pet/{petId}.types.ts",
           "repository": Repository {
@@ -4836,12 +5149,34 @@ if (statusCode === \\"404\\") {
             "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/get@[object Object]:true" => "HTTP_GET",
             "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/post@[object Object]:true" => "HTTP_POST",
             "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/delete@[object Object]:true" => "HTTP_DELETE",
-            "tools@internal/tools.ts:true" => "Tools",
             "SchemaTypeCoder@undefined@components/Pet.ts:true" => "Pet",
+            "tools@internal/tools.ts:true" => "Tools",
           },
           "exports": Map {
             "HTTP_GET" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: never, path: {petId: number}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: never, path: {petId: number}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  Pet
+            },
+\\"application/json\\": { 
+              schema:  Pet
+            }
+    };
+        },400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: Pet
@@ -4861,7 +5196,8 @@ if (statusCode === \\"404\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/get",
               "isType": true,
@@ -4870,12 +5206,20 @@ if (statusCode === \\"404\\") {
               "typeDeclaration": "",
             },
             "HTTP_POST" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: {name?: number, status?: string}, path: {petId: number}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: {name?: number, status?: string}, path: {petId: number}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      405: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 405, 
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/post",
               "isType": true,
@@ -4884,12 +5228,20 @@ if (statusCode === \\"404\\") {
               "typeDeclaration": "",
             },
             "HTTP_DELETE" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: never, path: {petId: string}, header: {api_key?: string}, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: never, path: {petId: string}, header: {api_key?: string}, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      400: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 400, 
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/delete",
               "isType": true,
@@ -4903,57 +5255,27 @@ if (statusCode === \\"404\\") {
               "isType": true,
               "modulePath": "../../context/context.js",
             },
+            "ResponseBuilderBuilder" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
+            "HttpStatusCode" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
           },
           "imports": Map {
-            "Tools" => Object {
+            "Pet" => Object {
               "isType": true,
-              "name": "Tools",
+              "name": "Pet",
               "script": Script {
                 "cache": Map {
-                  "tools@[object Object]:true" => "Tools",
-                },
-                "exports": Map {
-                  "Tools" => Object {
-                    "code": "
-    {
-        oneOf: (array: string[]) => string;
-        randomFromSchema: (schema: JSONSchema6 ) => unknown;
-        accepts: (contentType: string) => boolean;
-    }",
-                    "done": true,
-                    "id": "tools",
-                    "isType": true,
-                    "name": "Tools",
-                    "promise": Promise {},
-                    "typeDeclaration": "",
-                  },
-                },
-                "externalImports": Map {
-                  "JSONSchema6" => Object {
-                    "isType": false,
-                    "modulePath": "json-schema",
-                  },
-                },
-                "imports": Map {},
-                "path": "internal/tools.ts",
-                "repository": Repository {
-                  "scripts": [Circular],
-                  "writeFiles": [Function],
-                },
-                "typeCache": Map {},
-              },
-            },
-            "Pet" => Object {
-              "isType": true,
-              "name": "Pet",
-              "script": Script {
-                "cache": Map {
-                  "SchemaTypeCoder@undefined@[object Object]:true" => "Pet",
-                  "SchemaCoder@undefined@[object Object]:false" => "PetSchema",
-                  "SchemaTypeCoder@undefined@components/Category.ts:true" => "Category",
-                  "SchemaTypeCoder@undefined@components/Tag.ts:true" => "Tag",
-                  "SchemaCoder@undefined@components/Category.ts:false" => "CategorySchema",
-                  "SchemaCoder@undefined@components/Tag.ts:false" => "TagSchema",
+                  "SchemaTypeCoder@undefined@[object Object]:true" => "Pet",
+                  "SchemaCoder@undefined@[object Object]:false" => "PetSchema",
+                  "SchemaTypeCoder@undefined@components/Category.ts:true" => "Category",
+                  "SchemaTypeCoder@undefined@components/Tag.ts:true" => "Tag",
+                  "SchemaCoder@undefined@components/Category.ts:false" => "CategorySchema",
+                  "SchemaCoder@undefined@components/Tag.ts:false" => "TagSchema",
                 },
                 "exports": Map {
                   "Pet" => Object {
@@ -5199,6 +5521,44 @@ if (statusCode === \\"404\\") {
                 "typeCache": Map {},
               },
             },
+            "Tools" => Object {
+              "isType": true,
+              "name": "Tools",
+              "script": Script {
+                "cache": Map {
+                  "tools@[object Object]:true" => "Tools",
+                },
+                "exports": Map {
+                  "Tools" => Object {
+                    "code": "
+    {
+        oneOf: (array: string[]) => string;
+        randomFromSchema: (schema: JSONSchema6 ) => unknown;
+        accepts: (contentType: string) => boolean;
+    }",
+                    "done": true,
+                    "id": "tools",
+                    "isType": true,
+                    "name": "Tools",
+                    "promise": Promise {},
+                    "typeDeclaration": "",
+                  },
+                },
+                "externalImports": Map {
+                  "JSONSchema6" => Object {
+                    "isType": false,
+                    "modulePath": "json-schema",
+                  },
+                },
+                "imports": Map {},
+                "path": "internal/tools.ts",
+                "repository": Repository {
+                  "scripts": [Circular],
+                  "writeFiles": [Function],
+                },
+                "typeCache": Map {},
+              },
+            },
           },
           "path": "path-types/pet/{petId}.types.ts",
           "repository": Repository {
@@ -5216,12 +5576,34 @@ if (statusCode === \\"404\\") {
             "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/get@[object Object]:true" => "HTTP_GET",
             "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/post@[object Object]:true" => "HTTP_POST",
             "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/delete@[object Object]:true" => "HTTP_DELETE",
-            "tools@internal/tools.ts:true" => "Tools",
             "SchemaTypeCoder@undefined@components/Pet.ts:true" => "Pet",
+            "tools@internal/tools.ts:true" => "Tools",
           },
           "exports": Map {
             "HTTP_GET" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: never, path: {petId: number}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: never, path: {petId: number}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  Pet
+            },
+\\"application/json\\": { 
+              schema:  Pet
+            }
+    };
+        },400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: Pet
@@ -5241,7 +5623,8 @@ if (statusCode === \\"404\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/get",
               "isType": true,
@@ -5250,12 +5633,20 @@ if (statusCode === \\"404\\") {
               "typeDeclaration": "",
             },
             "HTTP_POST" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: {name?: number, status?: string}, path: {petId: number}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: {name?: number, status?: string}, path: {petId: number}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      405: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 405, 
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/post",
               "isType": true,
@@ -5264,12 +5655,20 @@ if (statusCode === \\"404\\") {
               "typeDeclaration": "",
             },
             "HTTP_DELETE" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: never, path: {petId: string}, header: {api_key?: string}, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: never, path: {petId: string}, header: {api_key?: string}, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      400: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 400, 
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/delete",
               "isType": true,
@@ -5283,46 +5682,16 @@ if (statusCode === \\"404\\") {
               "isType": true,
               "modulePath": "../../context/context.js",
             },
-          },
-          "imports": Map {
-            "Tools" => Object {
+            "ResponseBuilderBuilder" => Object {
               "isType": true,
-              "name": "Tools",
-              "script": Script {
-                "cache": Map {
-                  "tools@[object Object]:true" => "Tools",
-                },
-                "exports": Map {
-                  "Tools" => Object {
-                    "code": "
-    {
-        oneOf: (array: string[]) => string;
-        randomFromSchema: (schema: JSONSchema6 ) => unknown;
-        accepts: (contentType: string) => boolean;
-    }",
-                    "done": true,
-                    "id": "tools",
-                    "isType": true,
-                    "name": "Tools",
-                    "promise": Promise {},
-                    "typeDeclaration": "",
-                  },
-                },
-                "externalImports": Map {
-                  "JSONSchema6" => Object {
-                    "isType": false,
-                    "modulePath": "json-schema",
-                  },
-                },
-                "imports": Map {},
-                "path": "internal/tools.ts",
-                "repository": Repository {
-                  "scripts": [Circular],
-                  "writeFiles": [Function],
-                },
-                "typeCache": Map {},
-              },
+              "modulePath": "counterfact",
+            },
+            "HttpStatusCode" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
             },
+          },
+          "imports": Map {
             "Pet" => Object {
               "isType": true,
               "name": "Pet",
@@ -5579,6 +5948,44 @@ if (statusCode === \\"404\\") {
                 "typeCache": Map {},
               },
             },
+            "Tools" => Object {
+              "isType": true,
+              "name": "Tools",
+              "script": Script {
+                "cache": Map {
+                  "tools@[object Object]:true" => "Tools",
+                },
+                "exports": Map {
+                  "Tools" => Object {
+                    "code": "
+    {
+        oneOf: (array: string[]) => string;
+        randomFromSchema: (schema: JSONSchema6 ) => unknown;
+        accepts: (contentType: string) => boolean;
+    }",
+                    "done": true,
+                    "id": "tools",
+                    "isType": true,
+                    "name": "Tools",
+                    "promise": Promise {},
+                    "typeDeclaration": "",
+                  },
+                },
+                "externalImports": Map {
+                  "JSONSchema6" => Object {
+                    "isType": false,
+                    "modulePath": "json-schema",
+                  },
+                },
+                "imports": Map {},
+                "path": "internal/tools.ts",
+                "repository": Repository {
+                  "scripts": [Circular],
+                  "writeFiles": [Function],
+                },
+                "typeCache": Map {},
+              },
+            },
           },
           "path": "path-types/pet/{petId}.types.ts",
           "repository": Repository {
@@ -6113,12 +6520,34 @@ if (statusCode === \\"404\\") {
       "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/get@[object Object]:true" => "HTTP_GET",
       "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/post@[object Object]:true" => "HTTP_POST",
       "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/delete@[object Object]:true" => "HTTP_DELETE",
-      "tools@internal/tools.ts:true" => "Tools",
       "SchemaTypeCoder@undefined@components/Pet.ts:true" => "Pet",
+      "tools@internal/tools.ts:true" => "Tools",
     },
     "exports": Map {
       "HTTP_GET" => Object {
-        "code": "({ query, path, header, body, context, tools }: { query: never, path: {petId: number}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+        "code": "({ query, path, header, body, context, tools }: { query: never, path: {petId: number}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  Pet
+            },
+\\"application/json\\": { 
+              schema:  Pet
+            }
+    };
+        },400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: Pet
@@ -6138,7 +6567,8 @@ if (statusCode === \\"404\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
         "done": true,
         "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/get",
         "isType": true,
@@ -6147,12 +6577,20 @@ if (statusCode === \\"404\\") {
         "typeDeclaration": "",
       },
       "HTTP_POST" => Object {
-        "code": "({ query, path, header, body, context, tools }: { query: {name?: number, status?: string}, path: {petId: number}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+        "code": "({ query, path, header, body, context, tools }: { query: {name?: number, status?: string}, path: {petId: number}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      405: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 405, 
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
         "done": true,
         "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/post",
         "isType": true,
@@ -6161,12 +6599,20 @@ if (statusCode === \\"404\\") {
         "typeDeclaration": "",
       },
       "HTTP_DELETE" => Object {
-        "code": "({ query, path, header, body, context, tools }: { query: never, path: {petId: string}, header: {api_key?: string}, body: undefined, context: Context, tools: Tools}) => {  
+        "code": "({ query, path, header, body, context, tools }: { query: never, path: {petId: string}, header: {api_key?: string}, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      400: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 400, 
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
         "done": true,
         "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}/delete",
         "isType": true,
@@ -6180,46 +6626,16 @@ if (statusCode === \\"404\\") {
         "isType": true,
         "modulePath": "../../context/context.js",
       },
-    },
-    "imports": Map {
-      "Tools" => Object {
+      "ResponseBuilderBuilder" => Object {
         "isType": true,
-        "name": "Tools",
-        "script": Script {
-          "cache": Map {
-            "tools@[object Object]:true" => "Tools",
-          },
-          "exports": Map {
-            "Tools" => Object {
-              "code": "
-    {
-        oneOf: (array: string[]) => string;
-        randomFromSchema: (schema: JSONSchema6 ) => unknown;
-        accepts: (contentType: string) => boolean;
-    }",
-              "done": true,
-              "id": "tools",
-              "isType": true,
-              "name": "Tools",
-              "promise": Promise {},
-              "typeDeclaration": "",
-            },
-          },
-          "externalImports": Map {
-            "JSONSchema6" => Object {
-              "isType": false,
-              "modulePath": "json-schema",
-            },
-          },
-          "imports": Map {},
-          "path": "internal/tools.ts",
-          "repository": Repository {
-            "scripts": [Circular],
-            "writeFiles": [Function],
-          },
-          "typeCache": Map {},
-        },
+        "modulePath": "counterfact",
       },
+      "HttpStatusCode" => Object {
+        "isType": true,
+        "modulePath": "counterfact",
+      },
+    },
+    "imports": Map {
       "Pet" => Object {
         "isType": true,
         "name": "Pet",
@@ -6476,6 +6892,44 @@ if (statusCode === \\"404\\") {
           "typeCache": Map {},
         },
       },
+      "Tools" => Object {
+        "isType": true,
+        "name": "Tools",
+        "script": Script {
+          "cache": Map {
+            "tools@[object Object]:true" => "Tools",
+          },
+          "exports": Map {
+            "Tools" => Object {
+              "code": "
+    {
+        oneOf: (array: string[]) => string;
+        randomFromSchema: (schema: JSONSchema6 ) => unknown;
+        accepts: (contentType: string) => boolean;
+    }",
+              "done": true,
+              "id": "tools",
+              "isType": true,
+              "name": "Tools",
+              "promise": Promise {},
+              "typeDeclaration": "",
+            },
+          },
+          "externalImports": Map {
+            "JSONSchema6" => Object {
+              "isType": false,
+              "modulePath": "json-schema",
+            },
+          },
+          "imports": Map {},
+          "path": "internal/tools.ts",
+          "repository": Repository {
+            "scripts": [Circular],
+            "writeFiles": [Function],
+          },
+          "typeCache": Map {},
+        },
+      },
     },
     "path": "path-types/pet/{petId}.types.ts",
     "repository": Repository {
@@ -6534,17 +6988,27 @@ if (statusCode === \\"404\\") {
         "script": Script {
           "cache": Map {
             "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}~1uploadImage/post@[object Object]:true" => "HTTP_POST",
-            "tools@internal/tools.ts:true" => "Tools",
             "SchemaTypeCoder@undefined@components/ApiResponse.ts:true" => "ApiResponse",
+            "tools@internal/tools.ts:true" => "Tools",
           },
           "exports": Map {
             "HTTP_POST" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: {additionalMetadata?: number}, path: {petId: number}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: {additionalMetadata?: number}, path: {petId: number}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/json\\": { 
+              schema:  ApiResponse
+            }
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/json\\",
           body?: ApiResponse
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}~1uploadImage/post",
               "isType": true,
@@ -6558,39 +7022,58 @@ if (statusCode === \\"404\\") {
               "isType": true,
               "modulePath": "../../../context/context.js",
             },
+            "ResponseBuilderBuilder" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
+            "HttpStatusCode" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
           },
           "imports": Map {
-            "Tools" => Object {
+            "ApiResponse" => Object {
               "isType": true,
-              "name": "Tools",
+              "name": "ApiResponse",
               "script": Script {
                 "cache": Map {
-                  "tools@[object Object]:true" => "Tools",
+                  "SchemaTypeCoder@undefined@[object Object]:true" => "ApiResponse",
+                  "SchemaCoder@undefined@[object Object]:false" => "ApiResponseSchema",
                 },
                 "exports": Map {
-                  "Tools" => Object {
-                    "code": "
-    {
-        oneOf: (array: string[]) => string;
-        randomFromSchema: (schema: JSONSchema6 ) => unknown;
-        accepts: (contentType: string) => boolean;
-    }",
+                  "ApiResponse" => Object {
+                    "code": "{code: number,type: string,message: string}",
                     "done": true,
-                    "id": "tools",
+                    "id": "SchemaTypeCoder@undefined",
                     "isType": true,
-                    "name": "Tools",
+                    "name": "ApiResponse",
                     "promise": Promise {},
                     "typeDeclaration": "",
                   },
+                  "ApiResponseSchema" => Object {
+                    "code": "
+      {
+        type: \\"object\\",
+        required: [],
+        properties: { \\"code\\": {\\"type\\":\\"integer\\",\\"format\\":\\"int32\\"}, \\"type\\": {\\"type\\":\\"string\\"}, \\"message\\": {\\"type\\":\\"string\\"} }
+      }
+    ",
+                    "done": true,
+                    "id": "SchemaCoder@undefined",
+                    "isType": false,
+                    "name": "ApiResponseSchema",
+                    "promise": Promise {},
+                    "typeDeclaration": "JSONSchema6",
+                  },
                 },
                 "externalImports": Map {
                   "JSONSchema6" => Object {
-                    "isType": false,
+                    "isType": true,
                     "modulePath": "json-schema",
                   },
                 },
                 "imports": Map {},
-                "path": "internal/tools.ts",
+                "path": "components/ApiResponse.ts",
                 "repository": Repository {
                   "scripts": [Circular],
                   "writeFiles": [Function],
@@ -6598,48 +7081,37 @@ if (statusCode === \\"404\\") {
                 "typeCache": Map {},
               },
             },
-            "ApiResponse" => Object {
+            "Tools" => Object {
               "isType": true,
-              "name": "ApiResponse",
+              "name": "Tools",
               "script": Script {
                 "cache": Map {
-                  "SchemaTypeCoder@undefined@[object Object]:true" => "ApiResponse",
-                  "SchemaCoder@undefined@[object Object]:false" => "ApiResponseSchema",
+                  "tools@[object Object]:true" => "Tools",
                 },
                 "exports": Map {
-                  "ApiResponse" => Object {
-                    "code": "{code: number,type: string,message: string}",
+                  "Tools" => Object {
+                    "code": "
+    {
+        oneOf: (array: string[]) => string;
+        randomFromSchema: (schema: JSONSchema6 ) => unknown;
+        accepts: (contentType: string) => boolean;
+    }",
                     "done": true,
-                    "id": "SchemaTypeCoder@undefined",
+                    "id": "tools",
                     "isType": true,
-                    "name": "ApiResponse",
+                    "name": "Tools",
                     "promise": Promise {},
                     "typeDeclaration": "",
                   },
-                  "ApiResponseSchema" => Object {
-                    "code": "
-      {
-        type: \\"object\\",
-        required: [],
-        properties: { \\"code\\": {\\"type\\":\\"integer\\",\\"format\\":\\"int32\\"}, \\"type\\": {\\"type\\":\\"string\\"}, \\"message\\": {\\"type\\":\\"string\\"} }
-      }
-    ",
-                    "done": true,
-                    "id": "SchemaCoder@undefined",
-                    "isType": false,
-                    "name": "ApiResponseSchema",
-                    "promise": Promise {},
-                    "typeDeclaration": "JSONSchema6",
-                  },
                 },
                 "externalImports": Map {
                   "JSONSchema6" => Object {
-                    "isType": true,
+                    "isType": false,
                     "modulePath": "json-schema",
                   },
                 },
                 "imports": Map {},
-                "path": "components/ApiResponse.ts",
+                "path": "internal/tools.ts",
                 "repository": Repository {
                   "scripts": [Circular],
                   "writeFiles": [Function],
@@ -6765,17 +7237,27 @@ if (statusCode === \\"404\\") {
   "path-types/pet/{petId}/uploadImage.types.ts" => Script {
     "cache": Map {
       "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}~1uploadImage/post@[object Object]:true" => "HTTP_POST",
-      "tools@internal/tools.ts:true" => "Tools",
       "SchemaTypeCoder@undefined@components/ApiResponse.ts:true" => "ApiResponse",
+      "tools@internal/tools.ts:true" => "Tools",
     },
     "exports": Map {
       "HTTP_POST" => Object {
-        "code": "({ query, path, header, body, context, tools }: { query: {additionalMetadata?: number}, path: {petId: number}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+        "code": "({ query, path, header, body, context, tools }: { query: {additionalMetadata?: number}, path: {petId: number}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/json\\": { 
+              schema:  ApiResponse
+            }
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/json\\",
           body?: ApiResponse
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
         "done": true,
         "id": "OperationTypeCoder@petstore.yaml#/paths/~1pet~1{petId}~1uploadImage/post",
         "isType": true,
@@ -6789,46 +7271,16 @@ if (statusCode === \\"404\\") {
         "isType": true,
         "modulePath": "../../../context/context.js",
       },
-    },
-    "imports": Map {
-      "Tools" => Object {
+      "ResponseBuilderBuilder" => Object {
         "isType": true,
-        "name": "Tools",
-        "script": Script {
-          "cache": Map {
-            "tools@[object Object]:true" => "Tools",
-          },
-          "exports": Map {
-            "Tools" => Object {
-              "code": "
-    {
-        oneOf: (array: string[]) => string;
-        randomFromSchema: (schema: JSONSchema6 ) => unknown;
-        accepts: (contentType: string) => boolean;
-    }",
-              "done": true,
-              "id": "tools",
-              "isType": true,
-              "name": "Tools",
-              "promise": Promise {},
-              "typeDeclaration": "",
-            },
-          },
-          "externalImports": Map {
-            "JSONSchema6" => Object {
-              "isType": false,
-              "modulePath": "json-schema",
-            },
-          },
-          "imports": Map {},
-          "path": "internal/tools.ts",
-          "repository": Repository {
-            "scripts": [Circular],
-            "writeFiles": [Function],
-          },
-          "typeCache": Map {},
-        },
+        "modulePath": "counterfact",
+      },
+      "HttpStatusCode" => Object {
+        "isType": true,
+        "modulePath": "counterfact",
       },
+    },
+    "imports": Map {
       "ApiResponse" => Object {
         "isType": true,
         "name": "ApiResponse",
@@ -6878,6 +7330,44 @@ if (statusCode === \\"404\\") {
           "typeCache": Map {},
         },
       },
+      "Tools" => Object {
+        "isType": true,
+        "name": "Tools",
+        "script": Script {
+          "cache": Map {
+            "tools@[object Object]:true" => "Tools",
+          },
+          "exports": Map {
+            "Tools" => Object {
+              "code": "
+    {
+        oneOf: (array: string[]) => string;
+        randomFromSchema: (schema: JSONSchema6 ) => unknown;
+        accepts: (contentType: string) => boolean;
+    }",
+              "done": true,
+              "id": "tools",
+              "isType": true,
+              "name": "Tools",
+              "promise": Promise {},
+              "typeDeclaration": "",
+            },
+          },
+          "externalImports": Map {
+            "JSONSchema6" => Object {
+              "isType": false,
+              "modulePath": "json-schema",
+            },
+          },
+          "imports": Map {},
+          "path": "internal/tools.ts",
+          "repository": Repository {
+            "scripts": [Circular],
+            "writeFiles": [Function],
+          },
+          "typeCache": Map {},
+        },
+      },
     },
     "path": "path-types/pet/{petId}/uploadImage.types.ts",
     "repository": Repository {
@@ -6944,12 +7434,22 @@ if (statusCode === \\"404\\") {
           },
           "exports": Map {
             "HTTP_GET" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/json\\": { 
+              schema:  {[key: string]: number}
+            }
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/json\\",
           body?: {[key: string]: number}
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1store~1inventory/get",
               "isType": true,
@@ -6963,6 +7463,14 @@ if (statusCode === \\"404\\") {
               "isType": true,
               "modulePath": "../../context/context.js",
             },
+            "ResponseBuilderBuilder" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
+            "HttpStatusCode" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
           },
           "imports": Map {
             "Tools" => Object {
@@ -7027,12 +7535,22 @@ if (statusCode === \\"404\\") {
     },
     "exports": Map {
       "HTTP_GET" => Object {
-        "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: undefined, context: Context, tools: Tools}) => {  
+        "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/json\\": { 
+              schema:  {[key: string]: number}
+            }
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/json\\",
           body?: {[key: string]: number}
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
         "done": true,
         "id": "OperationTypeCoder@petstore.yaml#/paths/~1store~1inventory/get",
         "isType": true,
@@ -7046,6 +7564,14 @@ if (statusCode === \\"404\\") {
         "isType": true,
         "modulePath": "../../context/context.js",
       },
+      "ResponseBuilderBuilder" => Object {
+        "isType": true,
+        "modulePath": "counterfact",
+      },
+      "HttpStatusCode" => Object {
+        "isType": true,
+        "modulePath": "counterfact",
+      },
     },
     "imports": Map {
       "Tools" => Object {
@@ -7154,7 +7680,21 @@ if (statusCode === \\"405\\") {
           },
           "exports": Map {
             "HTTP_POST" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: Order, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: Order, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/json\\": { 
+              schema:  Order
+            }
+    };
+        },405: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/json\\",
           body?: Order
@@ -7164,7 +7704,8 @@ if (statusCode === \\"405\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1store~1order/post",
               "isType": true,
@@ -7178,6 +7719,14 @@ if (statusCode === \\"405\\") {
               "isType": true,
               "modulePath": "../../context/context.js",
             },
+            "ResponseBuilderBuilder" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
+            "HttpStatusCode" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
           },
           "imports": Map {
             "Order" => Object {
@@ -7390,7 +7939,21 @@ if (statusCode === \\"405\\") {
     },
     "exports": Map {
       "HTTP_POST" => Object {
-        "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: Order, context: Context, tools: Tools}) => {  
+        "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: Order, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/json\\": { 
+              schema:  Order
+            }
+    };
+        },405: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/json\\",
           body?: Order
@@ -7400,7 +7963,8 @@ if (statusCode === \\"405\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
         "done": true,
         "id": "OperationTypeCoder@petstore.yaml#/paths/~1store~1order/post",
         "isType": true,
@@ -7414,6 +7978,14 @@ if (statusCode === \\"405\\") {
         "isType": true,
         "modulePath": "../../context/context.js",
       },
+      "ResponseBuilderBuilder" => Object {
+        "isType": true,
+        "modulePath": "counterfact",
+      },
+      "HttpStatusCode" => Object {
+        "isType": true,
+        "modulePath": "counterfact",
+      },
     },
     "imports": Map {
       "Order" => Object {
@@ -7615,12 +8187,34 @@ if (statusCode === \\"404\\") {
           "cache": Map {
             "OperationTypeCoder@petstore.yaml#/paths/~1store~1order~1{orderId}/get@[object Object]:true" => "HTTP_GET",
             "OperationTypeCoder@petstore.yaml#/paths/~1store~1order~1{orderId}/delete@[object Object]:true" => "HTTP_DELETE",
-            "tools@internal/tools.ts:true" => "Tools",
             "SchemaTypeCoder@undefined@components/Order.ts:true" => "Order",
+            "tools@internal/tools.ts:true" => "Tools",
           },
           "exports": Map {
             "HTTP_GET" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: never, path: {orderId: number}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: never, path: {orderId: number}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  Order
+            },
+\\"application/json\\": { 
+              schema:  Order
+            }
+    };
+        },400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: Order
@@ -7640,7 +8234,8 @@ if (statusCode === \\"404\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1store~1order~1{orderId}/get",
               "isType": true,
@@ -7649,7 +8244,19 @@ if (statusCode === \\"404\\") {
               "typeDeclaration": "",
             },
             "HTTP_DELETE" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: never, path: {orderId: number}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: never, path: {orderId: number}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 400, 
           
           
@@ -7659,7 +8266,8 @@ if (statusCode === \\"404\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1store~1order~1{orderId}/delete",
               "isType": true,
@@ -7673,46 +8281,16 @@ if (statusCode === \\"404\\") {
               "isType": true,
               "modulePath": "../../../context/context.js",
             },
-          },
-          "imports": Map {
-            "Tools" => Object {
+            "ResponseBuilderBuilder" => Object {
               "isType": true,
-              "name": "Tools",
-              "script": Script {
-                "cache": Map {
-                  "tools@[object Object]:true" => "Tools",
-                },
-                "exports": Map {
-                  "Tools" => Object {
-                    "code": "
-    {
-        oneOf: (array: string[]) => string;
-        randomFromSchema: (schema: JSONSchema6 ) => unknown;
-        accepts: (contentType: string) => boolean;
-    }",
-                    "done": true,
-                    "id": "tools",
-                    "isType": true,
-                    "name": "Tools",
-                    "promise": Promise {},
-                    "typeDeclaration": "",
-                  },
-                },
-                "externalImports": Map {
-                  "JSONSchema6" => Object {
-                    "isType": false,
-                    "modulePath": "json-schema",
-                  },
-                },
-                "imports": Map {},
-                "path": "internal/tools.ts",
-                "repository": Repository {
-                  "scripts": [Circular],
-                  "writeFiles": [Function],
-                },
-                "typeCache": Map {},
-              },
+              "modulePath": "counterfact",
+            },
+            "HttpStatusCode" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
             },
+          },
+          "imports": Map {
             "Order" => Object {
               "isType": true,
               "name": "Order",
@@ -7762,82 +8340,6 @@ if (statusCode === \\"404\\") {
                 "typeCache": Map {},
               },
             },
-          },
-          "path": "path-types/store/order/{orderId}.types.ts",
-          "repository": Repository {
-            "scripts": [Circular],
-            "writeFiles": [Function],
-          },
-          "typeCache": Map {},
-        },
-      },
-      "HTTP_DELETE" => Object {
-        "isType": true,
-        "name": "HTTP_DELETE",
-        "script": Script {
-          "cache": Map {
-            "OperationTypeCoder@petstore.yaml#/paths/~1store~1order~1{orderId}/get@[object Object]:true" => "HTTP_GET",
-            "OperationTypeCoder@petstore.yaml#/paths/~1store~1order~1{orderId}/delete@[object Object]:true" => "HTTP_DELETE",
-            "tools@internal/tools.ts:true" => "Tools",
-            "SchemaTypeCoder@undefined@components/Order.ts:true" => "Order",
-          },
-          "exports": Map {
-            "HTTP_GET" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: never, path: {orderId: number}, header: never, body: undefined, context: Context, tools: Tools}) => {  
-            status: 200, 
-          contentType?: \\"application/xml\\",
-          body?: Order
-          
-        } | {  
-            status: 200, 
-          contentType?: \\"application/json\\",
-          body?: Order
-          
-        } | {  
-            status: 400, 
-          
-          
-          
-        } | {  
-            status: 404, 
-          
-          
-          
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
-              "done": true,
-              "id": "OperationTypeCoder@petstore.yaml#/paths/~1store~1order~1{orderId}/get",
-              "isType": true,
-              "name": "HTTP_GET",
-              "promise": Promise {},
-              "typeDeclaration": "",
-            },
-            "HTTP_DELETE" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: never, path: {orderId: number}, header: never, body: undefined, context: Context, tools: Tools}) => {  
-            status: 400, 
-          
-          
-          
-        } | {  
-            status: 404, 
-          
-          
-          
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
-              "done": true,
-              "id": "OperationTypeCoder@petstore.yaml#/paths/~1store~1order~1{orderId}/delete",
-              "isType": true,
-              "name": "HTTP_DELETE",
-              "promise": Promise {},
-              "typeDeclaration": "",
-            },
-          },
-          "externalImports": Map {
-            "Context" => Object {
-              "isType": true,
-              "modulePath": "../../../context/context.js",
-            },
-          },
-          "imports": Map {
             "Tools" => Object {
               "isType": true,
               "name": "Tools",
@@ -7876,6 +8378,126 @@ if (statusCode === \\"404\\") {
                 "typeCache": Map {},
               },
             },
+          },
+          "path": "path-types/store/order/{orderId}.types.ts",
+          "repository": Repository {
+            "scripts": [Circular],
+            "writeFiles": [Function],
+          },
+          "typeCache": Map {},
+        },
+      },
+      "HTTP_DELETE" => Object {
+        "isType": true,
+        "name": "HTTP_DELETE",
+        "script": Script {
+          "cache": Map {
+            "OperationTypeCoder@petstore.yaml#/paths/~1store~1order~1{orderId}/get@[object Object]:true" => "HTTP_GET",
+            "OperationTypeCoder@petstore.yaml#/paths/~1store~1order~1{orderId}/delete@[object Object]:true" => "HTTP_DELETE",
+            "SchemaTypeCoder@undefined@components/Order.ts:true" => "Order",
+            "tools@internal/tools.ts:true" => "Tools",
+          },
+          "exports": Map {
+            "HTTP_GET" => Object {
+              "code": "({ query, path, header, body, context, tools }: { query: never, path: {orderId: number}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  Order
+            },
+\\"application/json\\": { 
+              schema:  Order
+            }
+    };
+        },400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
+            status: 200, 
+          contentType?: \\"application/xml\\",
+          body?: Order
+          
+        } | {  
+            status: 200, 
+          contentType?: \\"application/json\\",
+          body?: Order
+          
+        } | {  
+            status: 400, 
+          
+          
+          
+        } | {  
+            status: 404, 
+          
+          
+          
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
+              "done": true,
+              "id": "OperationTypeCoder@petstore.yaml#/paths/~1store~1order~1{orderId}/get",
+              "isType": true,
+              "name": "HTTP_GET",
+              "promise": Promise {},
+              "typeDeclaration": "",
+            },
+            "HTTP_DELETE" => Object {
+              "code": "({ query, path, header, body, context, tools }: { query: never, path: {orderId: number}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
+            status: 400, 
+          
+          
+          
+        } | {  
+            status: 404, 
+          
+          
+          
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
+              "done": true,
+              "id": "OperationTypeCoder@petstore.yaml#/paths/~1store~1order~1{orderId}/delete",
+              "isType": true,
+              "name": "HTTP_DELETE",
+              "promise": Promise {},
+              "typeDeclaration": "",
+            },
+          },
+          "externalImports": Map {
+            "Context" => Object {
+              "isType": true,
+              "modulePath": "../../../context/context.js",
+            },
+            "ResponseBuilderBuilder" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
+            "HttpStatusCode" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
+          },
+          "imports": Map {
             "Order" => Object {
               "isType": true,
               "name": "Order",
@@ -7925,6 +8547,44 @@ if (statusCode === \\"404\\") {
                 "typeCache": Map {},
               },
             },
+            "Tools" => Object {
+              "isType": true,
+              "name": "Tools",
+              "script": Script {
+                "cache": Map {
+                  "tools@[object Object]:true" => "Tools",
+                },
+                "exports": Map {
+                  "Tools" => Object {
+                    "code": "
+    {
+        oneOf: (array: string[]) => string;
+        randomFromSchema: (schema: JSONSchema6 ) => unknown;
+        accepts: (contentType: string) => boolean;
+    }",
+                    "done": true,
+                    "id": "tools",
+                    "isType": true,
+                    "name": "Tools",
+                    "promise": Promise {},
+                    "typeDeclaration": "",
+                  },
+                },
+                "externalImports": Map {
+                  "JSONSchema6" => Object {
+                    "isType": false,
+                    "modulePath": "json-schema",
+                  },
+                },
+                "imports": Map {},
+                "path": "internal/tools.ts",
+                "repository": Repository {
+                  "scripts": [Circular],
+                  "writeFiles": [Function],
+                },
+                "typeCache": Map {},
+              },
+            },
           },
           "path": "path-types/store/order/{orderId}.types.ts",
           "repository": Repository {
@@ -8044,12 +8704,34 @@ if (statusCode === \\"404\\") {
     "cache": Map {
       "OperationTypeCoder@petstore.yaml#/paths/~1store~1order~1{orderId}/get@[object Object]:true" => "HTTP_GET",
       "OperationTypeCoder@petstore.yaml#/paths/~1store~1order~1{orderId}/delete@[object Object]:true" => "HTTP_DELETE",
-      "tools@internal/tools.ts:true" => "Tools",
       "SchemaTypeCoder@undefined@components/Order.ts:true" => "Order",
+      "tools@internal/tools.ts:true" => "Tools",
     },
     "exports": Map {
       "HTTP_GET" => Object {
-        "code": "({ query, path, header, body, context, tools }: { query: never, path: {orderId: number}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+        "code": "({ query, path, header, body, context, tools }: { query: never, path: {orderId: number}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  Order
+            },
+\\"application/json\\": { 
+              schema:  Order
+            }
+    };
+        },400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: Order
@@ -8069,7 +8751,8 @@ if (statusCode === \\"404\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
         "done": true,
         "id": "OperationTypeCoder@petstore.yaml#/paths/~1store~1order~1{orderId}/get",
         "isType": true,
@@ -8078,7 +8761,19 @@ if (statusCode === \\"404\\") {
         "typeDeclaration": "",
       },
       "HTTP_DELETE" => Object {
-        "code": "({ query, path, header, body, context, tools }: { query: never, path: {orderId: number}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+        "code": "({ query, path, header, body, context, tools }: { query: never, path: {orderId: number}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 400, 
           
           
@@ -8088,7 +8783,8 @@ if (statusCode === \\"404\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
         "done": true,
         "id": "OperationTypeCoder@petstore.yaml#/paths/~1store~1order~1{orderId}/delete",
         "isType": true,
@@ -8102,46 +8798,16 @@ if (statusCode === \\"404\\") {
         "isType": true,
         "modulePath": "../../../context/context.js",
       },
-    },
-    "imports": Map {
-      "Tools" => Object {
+      "ResponseBuilderBuilder" => Object {
         "isType": true,
-        "name": "Tools",
-        "script": Script {
-          "cache": Map {
-            "tools@[object Object]:true" => "Tools",
-          },
-          "exports": Map {
-            "Tools" => Object {
-              "code": "
-    {
-        oneOf: (array: string[]) => string;
-        randomFromSchema: (schema: JSONSchema6 ) => unknown;
-        accepts: (contentType: string) => boolean;
-    }",
-              "done": true,
-              "id": "tools",
-              "isType": true,
-              "name": "Tools",
-              "promise": Promise {},
-              "typeDeclaration": "",
-            },
-          },
-          "externalImports": Map {
-            "JSONSchema6" => Object {
-              "isType": false,
-              "modulePath": "json-schema",
-            },
-          },
-          "imports": Map {},
-          "path": "internal/tools.ts",
-          "repository": Repository {
-            "scripts": [Circular],
-            "writeFiles": [Function],
-          },
-          "typeCache": Map {},
-        },
+        "modulePath": "counterfact",
       },
+      "HttpStatusCode" => Object {
+        "isType": true,
+        "modulePath": "counterfact",
+      },
+    },
+    "imports": Map {
       "Order" => Object {
         "isType": true,
         "name": "Order",
@@ -8191,6 +8857,44 @@ if (statusCode === \\"404\\") {
           "typeCache": Map {},
         },
       },
+      "Tools" => Object {
+        "isType": true,
+        "name": "Tools",
+        "script": Script {
+          "cache": Map {
+            "tools@[object Object]:true" => "Tools",
+          },
+          "exports": Map {
+            "Tools" => Object {
+              "code": "
+    {
+        oneOf: (array: string[]) => string;
+        randomFromSchema: (schema: JSONSchema6 ) => unknown;
+        accepts: (contentType: string) => boolean;
+    }",
+              "done": true,
+              "id": "tools",
+              "isType": true,
+              "name": "Tools",
+              "promise": Promise {},
+              "typeDeclaration": "",
+            },
+          },
+          "externalImports": Map {
+            "JSONSchema6" => Object {
+              "isType": false,
+              "modulePath": "json-schema",
+            },
+          },
+          "imports": Map {},
+          "path": "internal/tools.ts",
+          "repository": Repository {
+            "scripts": [Circular],
+            "writeFiles": [Function],
+          },
+          "typeCache": Map {},
+        },
+      },
     },
     "path": "path-types/store/order/{orderId}.types.ts",
     "repository": Repository {
@@ -8265,7 +8969,19 @@ if (tools.accepts(\\"application/xml\\")) {
           },
           "exports": Map {
             "HTTP_POST" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: User, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: User, context: Context, response: ResponseBuilderBuilder<{
+      [statusCode in HttpStatusCode]: {
+          headers: {};
+          content: {
+      \\"application/json\\": { 
+              schema:  User
+            },
+\\"application/xml\\": { 
+              schema:  User
+            }
+    };
+        }
+      }>, tools: Tools}) => {  
             status: number | undefined, 
           contentType?: \\"application/json\\",
           body?: User
@@ -8275,7 +8991,8 @@ if (tools.accepts(\\"application/xml\\")) {
           contentType?: \\"application/xml\\",
           body?: User
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1user/post",
               "isType": true,
@@ -8289,6 +9006,14 @@ if (tools.accepts(\\"application/xml\\")) {
               "isType": true,
               "modulePath": "../context/context.js",
             },
+            "ResponseBuilderBuilder" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
+            "HttpStatusCode" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
           },
           "imports": Map {
             "User" => Object {
@@ -8501,7 +9226,19 @@ if (tools.accepts(\\"application/xml\\")) {
     },
     "exports": Map {
       "HTTP_POST" => Object {
-        "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: User, context: Context, tools: Tools}) => {  
+        "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: User, context: Context, response: ResponseBuilderBuilder<{
+      [statusCode in HttpStatusCode]: {
+          headers: {};
+          content: {
+      \\"application/json\\": { 
+              schema:  User
+            },
+\\"application/xml\\": { 
+              schema:  User
+            }
+    };
+        }
+      }>, tools: Tools}) => {  
             status: number | undefined, 
           contentType?: \\"application/json\\",
           body?: User
@@ -8511,7 +9248,8 @@ if (tools.accepts(\\"application/xml\\")) {
           contentType?: \\"application/xml\\",
           body?: User
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
         "done": true,
         "id": "OperationTypeCoder@petstore.yaml#/paths/~1user/post",
         "isType": true,
@@ -8525,6 +9263,14 @@ if (tools.accepts(\\"application/xml\\")) {
         "isType": true,
         "modulePath": "../context/context.js",
       },
+      "ResponseBuilderBuilder" => Object {
+        "isType": true,
+        "modulePath": "counterfact",
+      },
+      "HttpStatusCode" => Object {
+        "isType": true,
+        "modulePath": "counterfact",
+      },
     },
     "imports": Map {
       "User" => Object {
@@ -8693,7 +9439,24 @@ return {
           },
           "exports": Map {
             "HTTP_POST" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: Array<User>, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: Array<User>, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  User
+            },
+\\"application/json\\": { 
+              schema:  User
+            }
+    };
+        },[statusCode in Exclude<HttpStatusCode, 200>]: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: User
@@ -8708,7 +9471,8 @@ return {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1user~1createWithList/post",
               "isType": true,
@@ -8722,6 +9486,14 @@ return {
               "isType": true,
               "modulePath": "../../context/context.js",
             },
+            "ResponseBuilderBuilder" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
+            "HttpStatusCode" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
           },
           "imports": Map {
             "User" => Object {
@@ -8934,7 +9706,24 @@ return {
     },
     "exports": Map {
       "HTTP_POST" => Object {
-        "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: Array<User>, context: Context, tools: Tools}) => {  
+        "code": "({ query, path, header, body, context, tools }: { query: undefined, path: undefined, header: undefined, body: Array<User>, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  User
+            },
+\\"application/json\\": { 
+              schema:  User
+            }
+    };
+        },[statusCode in Exclude<HttpStatusCode, 200>]: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: User
@@ -8949,7 +9738,8 @@ return {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
         "done": true,
         "id": "OperationTypeCoder@petstore.yaml#/paths/~1user~1createWithList/post",
         "isType": true,
@@ -8963,6 +9753,14 @@ return {
         "isType": true,
         "modulePath": "../../context/context.js",
       },
+      "ResponseBuilderBuilder" => Object {
+        "isType": true,
+        "modulePath": "counterfact",
+      },
+      "HttpStatusCode" => Object {
+        "isType": true,
+        "modulePath": "counterfact",
+      },
     },
     "imports": Map {
       "User" => Object {
@@ -9130,7 +9928,24 @@ if (statusCode === \\"400\\") {
           },
           "exports": Map {
             "HTTP_GET" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: {username?: string, password?: string}, path: never, header: never, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: {username?: string, password?: string}, path: never, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  string
+            },
+\\"application/json\\": { 
+              schema:  string
+            }
+    };
+        },400: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: string
@@ -9145,7 +9960,8 @@ if (statusCode === \\"400\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1user~1login/get",
               "isType": true,
@@ -9159,6 +9975,14 @@ if (statusCode === \\"400\\") {
               "isType": true,
               "modulePath": "../../context/context.js",
             },
+            "ResponseBuilderBuilder" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
+            "HttpStatusCode" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
           },
           "imports": Map {
             "Tools" => Object {
@@ -9223,7 +10047,24 @@ if (statusCode === \\"400\\") {
     },
     "exports": Map {
       "HTTP_GET" => Object {
-        "code": "({ query, path, header, body, context, tools }: { query: {username?: string, password?: string}, path: never, header: never, body: undefined, context: Context, tools: Tools}) => {  
+        "code": "({ query, path, header, body, context, tools }: { query: {username?: string, password?: string}, path: never, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  string
+            },
+\\"application/json\\": { 
+              schema:  string
+            }
+    };
+        },400: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: string
@@ -9238,7 +10079,8 @@ if (statusCode === \\"400\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
         "done": true,
         "id": "OperationTypeCoder@petstore.yaml#/paths/~1user~1login/get",
         "isType": true,
@@ -9252,6 +10094,14 @@ if (statusCode === \\"400\\") {
         "isType": true,
         "modulePath": "../../context/context.js",
       },
+      "ResponseBuilderBuilder" => Object {
+        "isType": true,
+        "modulePath": "counterfact",
+      },
+      "HttpStatusCode" => Object {
+        "isType": true,
+        "modulePath": "counterfact",
+      },
     },
     "imports": Map {
       "Tools" => Object {
@@ -9340,12 +10190,20 @@ if (statusCode === \\"400\\") {
           },
           "exports": Map {
             "HTTP_GET" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: never, path: never, header: never, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: never, path: never, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      [statusCode in HttpStatusCode]: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: number | undefined, 
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1user~1logout/get",
               "isType": true,
@@ -9359,6 +10217,14 @@ if (statusCode === \\"400\\") {
               "isType": true,
               "modulePath": "../../context/context.js",
             },
+            "ResponseBuilderBuilder" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
+            "HttpStatusCode" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
+            },
           },
           "imports": Map {
             "Tools" => Object {
@@ -9423,12 +10289,20 @@ if (statusCode === \\"400\\") {
     },
     "exports": Map {
       "HTTP_GET" => Object {
-        "code": "({ query, path, header, body, context, tools }: { query: never, path: never, header: never, body: undefined, context: Context, tools: Tools}) => {  
+        "code": "({ query, path, header, body, context, tools }: { query: never, path: never, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      [statusCode in HttpStatusCode]: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: number | undefined, 
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
         "done": true,
         "id": "OperationTypeCoder@petstore.yaml#/paths/~1user~1logout/get",
         "isType": true,
@@ -9442,6 +10316,14 @@ if (statusCode === \\"400\\") {
         "isType": true,
         "modulePath": "../../context/context.js",
       },
+      "ResponseBuilderBuilder" => Object {
+        "isType": true,
+        "modulePath": "counterfact",
+      },
+      "HttpStatusCode" => Object {
+        "isType": true,
+        "modulePath": "counterfact",
+      },
     },
     "imports": Map {
       "Tools" => Object {
@@ -9618,12 +10500,34 @@ if (statusCode === \\"404\\") {
             "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/get@[object Object]:true" => "HTTP_GET",
             "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/put@[object Object]:true" => "HTTP_PUT",
             "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/delete@[object Object]:true" => "HTTP_DELETE",
-            "tools@internal/tools.ts:true" => "Tools",
             "SchemaTypeCoder@undefined@components/User.ts:true" => "User",
+            "tools@internal/tools.ts:true" => "Tools",
           },
           "exports": Map {
             "HTTP_GET" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  User
+            },
+\\"application/json\\": { 
+              schema:  User
+            }
+    };
+        },400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: User
@@ -9643,7 +10547,8 @@ if (statusCode === \\"404\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/get",
               "isType": true,
@@ -9652,12 +10557,20 @@ if (statusCode === \\"404\\") {
               "typeDeclaration": "",
             },
             "HTTP_PUT" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: User, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: User, context: Context, response: ResponseBuilderBuilder<{
+      [statusCode in HttpStatusCode]: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: number | undefined, 
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/put",
               "isType": true,
@@ -9666,7 +10579,19 @@ if (statusCode === \\"404\\") {
               "typeDeclaration": "",
             },
             "HTTP_DELETE" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 400, 
           
           
@@ -9676,7 +10601,8 @@ if (statusCode === \\"404\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/delete",
               "isType": true,
@@ -9690,46 +10616,16 @@ if (statusCode === \\"404\\") {
               "isType": true,
               "modulePath": "../../context/context.js",
             },
-          },
-          "imports": Map {
-            "Tools" => Object {
+            "ResponseBuilderBuilder" => Object {
               "isType": true,
-              "name": "Tools",
-              "script": Script {
-                "cache": Map {
-                  "tools@[object Object]:true" => "Tools",
-                },
-                "exports": Map {
-                  "Tools" => Object {
-                    "code": "
-    {
-        oneOf: (array: string[]) => string;
-        randomFromSchema: (schema: JSONSchema6 ) => unknown;
-        accepts: (contentType: string) => boolean;
-    }",
-                    "done": true,
-                    "id": "tools",
-                    "isType": true,
-                    "name": "Tools",
-                    "promise": Promise {},
-                    "typeDeclaration": "",
-                  },
-                },
-                "externalImports": Map {
-                  "JSONSchema6" => Object {
-                    "isType": false,
-                    "modulePath": "json-schema",
-                  },
-                },
-                "imports": Map {},
-                "path": "internal/tools.ts",
-                "repository": Repository {
-                  "scripts": [Circular],
-                  "writeFiles": [Function],
-                },
-                "typeCache": Map {},
-              },
+              "modulePath": "counterfact",
+            },
+            "HttpStatusCode" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
             },
+          },
+          "imports": Map {
             "User" => Object {
               "isType": true,
               "name": "User",
@@ -9779,6 +10675,44 @@ if (statusCode === \\"404\\") {
                 "typeCache": Map {},
               },
             },
+            "Tools" => Object {
+              "isType": true,
+              "name": "Tools",
+              "script": Script {
+                "cache": Map {
+                  "tools@[object Object]:true" => "Tools",
+                },
+                "exports": Map {
+                  "Tools" => Object {
+                    "code": "
+    {
+        oneOf: (array: string[]) => string;
+        randomFromSchema: (schema: JSONSchema6 ) => unknown;
+        accepts: (contentType: string) => boolean;
+    }",
+                    "done": true,
+                    "id": "tools",
+                    "isType": true,
+                    "name": "Tools",
+                    "promise": Promise {},
+                    "typeDeclaration": "",
+                  },
+                },
+                "externalImports": Map {
+                  "JSONSchema6" => Object {
+                    "isType": false,
+                    "modulePath": "json-schema",
+                  },
+                },
+                "imports": Map {},
+                "path": "internal/tools.ts",
+                "repository": Repository {
+                  "scripts": [Circular],
+                  "writeFiles": [Function],
+                },
+                "typeCache": Map {},
+              },
+            },
           },
           "path": "path-types/user/{username}.types.ts",
           "repository": Repository {
@@ -9796,12 +10730,34 @@ if (statusCode === \\"404\\") {
             "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/get@[object Object]:true" => "HTTP_GET",
             "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/put@[object Object]:true" => "HTTP_PUT",
             "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/delete@[object Object]:true" => "HTTP_DELETE",
-            "tools@internal/tools.ts:true" => "Tools",
             "SchemaTypeCoder@undefined@components/User.ts:true" => "User",
+            "tools@internal/tools.ts:true" => "Tools",
           },
           "exports": Map {
             "HTTP_GET" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  User
+            },
+\\"application/json\\": { 
+              schema:  User
+            }
+    };
+        },400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: User
@@ -9821,7 +10777,8 @@ if (statusCode === \\"404\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/get",
               "isType": true,
@@ -9830,12 +10787,20 @@ if (statusCode === \\"404\\") {
               "typeDeclaration": "",
             },
             "HTTP_PUT" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: User, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: User, context: Context, response: ResponseBuilderBuilder<{
+      [statusCode in HttpStatusCode]: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: number | undefined, 
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/put",
               "isType": true,
@@ -9844,7 +10809,19 @@ if (statusCode === \\"404\\") {
               "typeDeclaration": "",
             },
             "HTTP_DELETE" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 400, 
           
           
@@ -9854,7 +10831,8 @@ if (statusCode === \\"404\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/delete",
               "isType": true,
@@ -9868,46 +10846,16 @@ if (statusCode === \\"404\\") {
               "isType": true,
               "modulePath": "../../context/context.js",
             },
-          },
-          "imports": Map {
-            "Tools" => Object {
+            "ResponseBuilderBuilder" => Object {
               "isType": true,
-              "name": "Tools",
-              "script": Script {
-                "cache": Map {
-                  "tools@[object Object]:true" => "Tools",
-                },
-                "exports": Map {
-                  "Tools" => Object {
-                    "code": "
-    {
-        oneOf: (array: string[]) => string;
-        randomFromSchema: (schema: JSONSchema6 ) => unknown;
-        accepts: (contentType: string) => boolean;
-    }",
-                    "done": true,
-                    "id": "tools",
-                    "isType": true,
-                    "name": "Tools",
-                    "promise": Promise {},
-                    "typeDeclaration": "",
-                  },
-                },
-                "externalImports": Map {
-                  "JSONSchema6" => Object {
-                    "isType": false,
-                    "modulePath": "json-schema",
-                  },
-                },
-                "imports": Map {},
-                "path": "internal/tools.ts",
-                "repository": Repository {
-                  "scripts": [Circular],
-                  "writeFiles": [Function],
-                },
-                "typeCache": Map {},
-              },
+              "modulePath": "counterfact",
+            },
+            "HttpStatusCode" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
             },
+          },
+          "imports": Map {
             "User" => Object {
               "isType": true,
               "name": "User",
@@ -9957,6 +10905,44 @@ if (statusCode === \\"404\\") {
                 "typeCache": Map {},
               },
             },
+            "Tools" => Object {
+              "isType": true,
+              "name": "Tools",
+              "script": Script {
+                "cache": Map {
+                  "tools@[object Object]:true" => "Tools",
+                },
+                "exports": Map {
+                  "Tools" => Object {
+                    "code": "
+    {
+        oneOf: (array: string[]) => string;
+        randomFromSchema: (schema: JSONSchema6 ) => unknown;
+        accepts: (contentType: string) => boolean;
+    }",
+                    "done": true,
+                    "id": "tools",
+                    "isType": true,
+                    "name": "Tools",
+                    "promise": Promise {},
+                    "typeDeclaration": "",
+                  },
+                },
+                "externalImports": Map {
+                  "JSONSchema6" => Object {
+                    "isType": false,
+                    "modulePath": "json-schema",
+                  },
+                },
+                "imports": Map {},
+                "path": "internal/tools.ts",
+                "repository": Repository {
+                  "scripts": [Circular],
+                  "writeFiles": [Function],
+                },
+                "typeCache": Map {},
+              },
+            },
           },
           "path": "path-types/user/{username}.types.ts",
           "repository": Repository {
@@ -9974,12 +10960,34 @@ if (statusCode === \\"404\\") {
             "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/get@[object Object]:true" => "HTTP_GET",
             "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/put@[object Object]:true" => "HTTP_PUT",
             "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/delete@[object Object]:true" => "HTTP_DELETE",
-            "tools@internal/tools.ts:true" => "Tools",
             "SchemaTypeCoder@undefined@components/User.ts:true" => "User",
+            "tools@internal/tools.ts:true" => "Tools",
           },
           "exports": Map {
             "HTTP_GET" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  User
+            },
+\\"application/json\\": { 
+              schema:  User
+            }
+    };
+        },400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: User
@@ -9999,7 +11007,8 @@ if (statusCode === \\"404\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/get",
               "isType": true,
@@ -10008,12 +11017,20 @@ if (statusCode === \\"404\\") {
               "typeDeclaration": "",
             },
             "HTTP_PUT" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: User, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: User, context: Context, response: ResponseBuilderBuilder<{
+      [statusCode in HttpStatusCode]: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: number | undefined, 
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/put",
               "isType": true,
@@ -10022,7 +11039,19 @@ if (statusCode === \\"404\\") {
               "typeDeclaration": "",
             },
             "HTTP_DELETE" => Object {
-              "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+              "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 400, 
           
           
@@ -10032,7 +11061,8 @@ if (statusCode === \\"404\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
               "done": true,
               "id": "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/delete",
               "isType": true,
@@ -10046,46 +11076,16 @@ if (statusCode === \\"404\\") {
               "isType": true,
               "modulePath": "../../context/context.js",
             },
-          },
-          "imports": Map {
-            "Tools" => Object {
+            "ResponseBuilderBuilder" => Object {
               "isType": true,
-              "name": "Tools",
-              "script": Script {
-                "cache": Map {
-                  "tools@[object Object]:true" => "Tools",
-                },
-                "exports": Map {
-                  "Tools" => Object {
-                    "code": "
-    {
-        oneOf: (array: string[]) => string;
-        randomFromSchema: (schema: JSONSchema6 ) => unknown;
-        accepts: (contentType: string) => boolean;
-    }",
-                    "done": true,
-                    "id": "tools",
-                    "isType": true,
-                    "name": "Tools",
-                    "promise": Promise {},
-                    "typeDeclaration": "",
-                  },
-                },
-                "externalImports": Map {
-                  "JSONSchema6" => Object {
-                    "isType": false,
-                    "modulePath": "json-schema",
-                  },
-                },
-                "imports": Map {},
-                "path": "internal/tools.ts",
-                "repository": Repository {
-                  "scripts": [Circular],
-                  "writeFiles": [Function],
-                },
-                "typeCache": Map {},
-              },
+              "modulePath": "counterfact",
+            },
+            "HttpStatusCode" => Object {
+              "isType": true,
+              "modulePath": "counterfact",
             },
+          },
+          "imports": Map {
             "User" => Object {
               "isType": true,
               "name": "User",
@@ -10135,6 +11135,44 @@ if (statusCode === \\"404\\") {
                 "typeCache": Map {},
               },
             },
+            "Tools" => Object {
+              "isType": true,
+              "name": "Tools",
+              "script": Script {
+                "cache": Map {
+                  "tools@[object Object]:true" => "Tools",
+                },
+                "exports": Map {
+                  "Tools" => Object {
+                    "code": "
+    {
+        oneOf: (array: string[]) => string;
+        randomFromSchema: (schema: JSONSchema6 ) => unknown;
+        accepts: (contentType: string) => boolean;
+    }",
+                    "done": true,
+                    "id": "tools",
+                    "isType": true,
+                    "name": "Tools",
+                    "promise": Promise {},
+                    "typeDeclaration": "",
+                  },
+                },
+                "externalImports": Map {
+                  "JSONSchema6" => Object {
+                    "isType": false,
+                    "modulePath": "json-schema",
+                  },
+                },
+                "imports": Map {},
+                "path": "internal/tools.ts",
+                "repository": Repository {
+                  "scripts": [Circular],
+                  "writeFiles": [Function],
+                },
+                "typeCache": Map {},
+              },
+            },
           },
           "path": "path-types/user/{username}.types.ts",
           "repository": Repository {
@@ -10255,12 +11293,34 @@ if (statusCode === \\"404\\") {
       "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/get@[object Object]:true" => "HTTP_GET",
       "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/put@[object Object]:true" => "HTTP_PUT",
       "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/delete@[object Object]:true" => "HTTP_DELETE",
-      "tools@internal/tools.ts:true" => "Tools",
       "SchemaTypeCoder@undefined@components/User.ts:true" => "User",
+      "tools@internal/tools.ts:true" => "Tools",
     },
     "exports": Map {
       "HTTP_GET" => Object {
-        "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+        "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      200: {
+          headers: {};
+          content: {
+      \\"application/xml\\": { 
+              schema:  User
+            },
+\\"application/json\\": { 
+              schema:  User
+            }
+    };
+        },400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 200, 
           contentType?: \\"application/xml\\",
           body?: User
@@ -10280,7 +11340,8 @@ if (statusCode === \\"404\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
         "done": true,
         "id": "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/get",
         "isType": true,
@@ -10289,12 +11350,20 @@ if (statusCode === \\"404\\") {
         "typeDeclaration": "",
       },
       "HTTP_PUT" => Object {
-        "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: User, context: Context, tools: Tools}) => {  
+        "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: User, context: Context, response: ResponseBuilderBuilder<{
+      [statusCode in HttpStatusCode]: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: number | undefined, 
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
         "done": true,
         "id": "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/put",
         "isType": true,
@@ -10303,7 +11372,19 @@ if (statusCode === \\"404\\") {
         "typeDeclaration": "",
       },
       "HTTP_DELETE" => Object {
-        "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: undefined, context: Context, tools: Tools}) => {  
+        "code": "({ query, path, header, body, context, tools }: { query: never, path: {username: string}, header: never, body: undefined, context: Context, response: ResponseBuilderBuilder<{
+      400: {
+          headers: {};
+          content: {
+      
+    };
+        },404: {
+          headers: {};
+          content: {
+      
+    };
+        }
+      }>, tools: Tools}) => {  
             status: 400, 
           
           
@@ -10313,7 +11394,8 @@ if (statusCode === \\"404\\") {
           
           
           
-        } | { status: 415, contentType: \\"text/plain\\", body: string }",
+        } | { status: 415, contentType: \\"text/plain\\", body: string }
+    | void",
         "done": true,
         "id": "OperationTypeCoder@petstore.yaml#/paths/~1user~1{username}/delete",
         "isType": true,
@@ -10327,46 +11409,16 @@ if (statusCode === \\"404\\") {
         "isType": true,
         "modulePath": "../../context/context.js",
       },
-    },
-    "imports": Map {
-      "Tools" => Object {
+      "ResponseBuilderBuilder" => Object {
         "isType": true,
-        "name": "Tools",
-        "script": Script {
-          "cache": Map {
-            "tools@[object Object]:true" => "Tools",
-          },
-          "exports": Map {
-            "Tools" => Object {
-              "code": "
-    {
-        oneOf: (array: string[]) => string;
-        randomFromSchema: (schema: JSONSchema6 ) => unknown;
-        accepts: (contentType: string) => boolean;
-    }",
-              "done": true,
-              "id": "tools",
-              "isType": true,
-              "name": "Tools",
-              "promise": Promise {},
-              "typeDeclaration": "",
-            },
-          },
-          "externalImports": Map {
-            "JSONSchema6" => Object {
-              "isType": false,
-              "modulePath": "json-schema",
-            },
-          },
-          "imports": Map {},
-          "path": "internal/tools.ts",
-          "repository": Repository {
-            "scripts": [Circular],
-            "writeFiles": [Function],
-          },
-          "typeCache": Map {},
-        },
+        "modulePath": "counterfact",
+      },
+      "HttpStatusCode" => Object {
+        "isType": true,
+        "modulePath": "counterfact",
       },
+    },
+    "imports": Map {
       "User" => Object {
         "isType": true,
         "name": "User",
@@ -10416,6 +11468,44 @@ if (statusCode === \\"404\\") {
           "typeCache": Map {},
         },
       },
+      "Tools" => Object {
+        "isType": true,
+        "name": "Tools",
+        "script": Script {
+          "cache": Map {
+            "tools@[object Object]:true" => "Tools",
+          },
+          "exports": Map {
+            "Tools" => Object {
+              "code": "
+    {
+        oneOf: (array: string[]) => string;
+        randomFromSchema: (schema: JSONSchema6 ) => unknown;
+        accepts: (contentType: string) => boolean;
+    }",
+              "done": true,
+              "id": "tools",
+              "isType": true,
+              "name": "Tools",
+              "promise": Promise {},
+              "typeDeclaration": "",
+            },
+          },
+          "externalImports": Map {
+            "JSONSchema6" => Object {
+              "isType": false,
+              "modulePath": "json-schema",
+            },
+          },
+          "imports": Map {},
+          "path": "internal/tools.ts",
+          "repository": Repository {
+            "scripts": [Circular],
+            "writeFiles": [Function],
+          },
+          "typeCache": Map {},
+        },
+      },
     },
     "path": "path-types/user/{username}.types.ts",
     "repository": Repository {
diff --git a/test/typescript-generator/__snapshots__/operation-type-coder.test.js.snap b/test/typescript-generator/__snapshots__/operation-type-coder.test.js.snap
index 4ad5d35..80afb70 100644
--- a/test/typescript-generator/__snapshots__/operation-type-coder.test.js.snap
+++ b/test/typescript-generator/__snapshots__/operation-type-coder.test.js.snap
@@ -14,6 +14,32 @@ exports[`an OperationTypeCoder generates a complex post operation 1`] = `
   header: { name?: string };
   body: Type;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    200: {
+      headers: {};
+      content: {
+        \\"application/json\\": {
+          schema: Type;
+        };
+      };
+    };
+    400: {
+      headers: {};
+      content: {
+        \\"application/json\\": {
+          schema: Type;
+        };
+      };
+    };
+    [statusCode in Exclude<HttpStatusCode, 200 | 400>]: {
+      headers: {};
+      content: {
+        \\"application/json\\": {
+          schema: Type;
+        };
+      };
+    };
+  }>;
   tools: Type;
 }) =>
   | {
@@ -31,7 +57,8 @@ exports[`an OperationTypeCoder generates a complex post operation 1`] = `
       contentType?: \\"application/json\\";
       body?: Type;
     }
-  | { status: 415; contentType: \\"text/plain\\"; body: string };
+  | { status: 415; contentType: \\"text/plain\\"; body: string }
+  | void;
 "
 `;
 
@@ -49,6 +76,16 @@ exports[`an OperationTypeCoder generates a simple get operation 1`] = `
   header: undefined;
   body: undefined;
   context: Context;
+  response: ResponseBuilderBuilder<{
+    [statusCode in HttpStatusCode]: {
+      headers: {};
+      content: {
+        \\"application/json\\": {
+          schema: Type;
+        };
+      };
+    };
+  }>;
   tools: Type;
 }) =>
   | {
@@ -56,6 +93,7 @@ exports[`an OperationTypeCoder generates a simple get operation 1`] = `
       contentType?: \\"application/json\\";
       body?: Type;
     }
-  | { status: 415; contentType: \\"text/plain\\"; body: string };
+  | { status: 415; contentType: \\"text/plain\\"; body: string }
+  | void;
 "
 `;
diff --git a/test/typescript-generator/response-type-coder.test.js b/test/typescript-generator/response-type-coder.test.js
new file mode 100644
index 0000000..514ac95
--- /dev/null
+++ b/test/typescript-generator/response-type-coder.test.js
@@ -0,0 +1,15 @@
+import { ResponseTypeCoder } from "../../src/typescript-generator/response-type-coder.js";
+
+describe("a ResponseTypeCoder", () => {
+  it("creates a type for a status code", () => {
+    const coder = new ResponseTypeCoder();
+
+    expect(coder.normalizeStatusCode("200", { default: {} })).toBe("200");
+    expect(coder.normalizeStatusCode("default", { default: {} })).toBe(
+      "[statusCode in HttpStatusCode]"
+    );
+    expect(coder.normalizeStatusCode("default", { 200: {}, 201: {} })).toBe(
+      "[statusCode in Exclude<HttpStatusCode, 200 | 201>]"
+    );
+  });
+});