Repository: pmcelhaney/counterfact
Pull request #279 (2022-10-15 19:56:30)

saturday refactoring
- change flatMap signature so the callback is (value, key) => result
- change requirement.map signature so the callback is (value, key) => result
- now that map() is refactored, flatMap() can got back to delegating to it
- change requirement.forEach signature so the callback is (value, key) => result
- refactor responseTypeCoder.normalizeStatusCode()
- simplify ResponseTypeCoder.buildContentObjectType
- simplify responseTypeCoder.buildHeaders
- rename variable for consistency with buildHeaders
- new printObjectFromEntries() function
- use printObjectFromEntries() in responseTypeCoder.buildHeaders()
- refactor ResponseTypeCoder so few arguments are passed around
- teasing apart ASTs and printers a little bit at a time


Some things I'm thinking about next:

1. There's an opportunity now for `requirement.get(key)` to return a NullRequirement instead of `undefined`.
2. Might want to `.keys()`, `.values()`, and `.entries()` to `Requirement`. 
3. I don't like `requirement.data`. I think it should be `requirement.value`. 
4. Still lots of low-hanging fruit in the `typescript-generator` 
5. Need to add more unit tests and rely less on snapshots 


Patch:
diff --git a/src/typescript-generator/generate.js b/src/typescript-generator/generate.js
index ae967aa..81c7f47 100644
--- a/src/typescript-generator/generate.js
+++ b/src/typescript-generator/generate.js
@@ -11,8 +11,8 @@ export async function generate(
 
   const requirement = await specification.requirementAt(`${source}#/paths`);
 
-  requirement.forEach(([key, pathDefinition]) => {
-    pathDefinition.forEach(([, operation]) => {
+  requirement.forEach((pathDefinition, key) => {
+    pathDefinition.forEach((operation) => {
       repository.get(`paths${key}.ts`).export(new OperationCoder(operation));
     });
   });
diff --git a/src/typescript-generator/operation-coder.js b/src/typescript-generator/operation-coder.js
index c794d09..b70a62a 100644
--- a/src/typescript-generator/operation-coder.js
+++ b/src/typescript-generator/operation-coder.js
@@ -16,8 +16,10 @@ export class OperationCoder extends Coder {
   write() {
     const responses = this.requirement.get("responses");
 
-    const [firstStatusCode] = responses.map(([statusCode]) => statusCode);
-    const [firstResponse] = responses.map(([, response]) => response.data);
+    const [firstStatusCode] = responses.map(
+      (response, statusCode) => statusCode
+    );
+    const [firstResponse] = responses.map((response) => response.data);
 
     if (!("content" in firstResponse)) {
       return "() => { /* no response content specified in the OpenAPI document */ }";
diff --git a/src/typescript-generator/operation-type-coder.js b/src/typescript-generator/operation-type-coder.js
index e0563fe..e1987aa 100644
--- a/src/typescript-generator/operation-type-coder.js
+++ b/src/typescript-generator/operation-type-coder.js
@@ -16,7 +16,7 @@ export class OperationTypeCoder extends Coder {
   responseTypes(script) {
     return this.requirement
       .get("responses")
-      .flatMap(([responseCode, response]) => {
+      .flatMap((response, responseCode) => {
         const status =
           responseCode === "default"
             ? "number | undefined"
@@ -29,7 +29,7 @@ export class OperationTypeCoder extends Coder {
         }
 
         return response.get("content").map(
-          ([contentType, content]) => `{  
+          (content, contentType) => `{  
             status: ${status}, 
             contentType?: "${contentType}",
             body?: ${new SchemaTypeCoder(content.get("schema")).write(script)}
diff --git a/src/typescript-generator/print-object-from-entries.js b/src/typescript-generator/print-object-from-entries.js
new file mode 100644
index 0000000..75302f8
--- /dev/null
+++ b/src/typescript-generator/print-object-from-entries.js
@@ -0,0 +1,5 @@
+export function printObjectFromEntries(entries) {
+  return `{\n${entries
+    .map(([key, value]) => `"${key}": ${value}`)
+    .join(",\n")}\n}`;
+}
diff --git a/src/typescript-generator/printers.js b/src/typescript-generator/printers.js
new file mode 100644
index 0000000..688617d
--- /dev/null
+++ b/src/typescript-generator/printers.js
@@ -0,0 +1,15 @@
+export function printObjectWithoutQuotes(entries) {
+  return `{\n${entries
+    .map(([key, value]) => `${key}: ${value}`)
+    .join(",\n")}\n}`;
+}
+
+export function printObject(entries) {
+  return `{\n${entries
+    .map(([key, value]) => `"${key}": ${value}`)
+    .join(",\n")}\n}`;
+}
+
+export function printArray(items) {
+  return `[\n${items.join(",\n")}\n]`;
+}
diff --git a/src/typescript-generator/requirement.js b/src/typescript-generator/requirement.js
index 7cf71eb..3962dfa 100644
--- a/src/typescript-generator/requirement.js
+++ b/src/typescript-generator/requirement.js
@@ -63,7 +63,7 @@ export class Requirement {
 
   forEach(callback) {
     Object.keys(this.data).forEach((key) => {
-      callback([key, this.select(this.escapeJsonPointer(key))]);
+      callback(this.select(this.escapeJsonPointer(key)), key);
     });
   }
 
@@ -71,7 +71,7 @@ export class Requirement {
     const result = [];
 
     // eslint-disable-next-line array-callback-return
-    this.forEach((entry) => result.push(callback(entry)));
+    this.forEach((value, key) => result.push(callback(value, key)));
 
     return result;
   }
diff --git a/src/typescript-generator/response-type-coder.js b/src/typescript-generator/response-type-coder.js
index 516e55e..0f47292 100644
--- a/src/typescript-generator/response-type-coder.js
+++ b/src/typescript-generator/response-type-coder.js
@@ -2,78 +2,79 @@ import nodePath from "node:path";
 
 import { Coder } from "./coder.js";
 import { SchemaTypeCoder } from "./schema-type-coder.js";
+import { printObject, printObjectWithoutQuotes } from "./printers.js";
 
 export class ResponseTypeCoder extends Coder {
-  normalizeStatusCode(statusCode, responses) {
-    const definedStatusCodes = Object.keys(responses).filter(
+  typeForDefaultStatusCode(listedStatusCodes) {
+    const definedStatusCodes = listedStatusCodes.filter(
       (key) => key !== "default"
     );
 
-    if (statusCode === "default") {
-      if (definedStatusCodes.length === 0) {
-        return "[statusCode in HttpStatusCode]";
-      }
+    if (definedStatusCodes.length === 0) {
+      return "[statusCode in HttpStatusCode]";
+    }
+
+    return `[statusCode in Exclude<HttpStatusCode, ${definedStatusCodes.join(
+      " | "
+    )}>]`;
+  }
 
-      return `[statusCode in Exclude<HttpStatusCode, ${definedStatusCodes.join(
-        " | "
-      )}>]`;
+  normalizeStatusCode(statusCode) {
+    if (statusCode === "default") {
+      return this.typeForDefaultStatusCode(Object.keys(this.requirement.data));
     }
 
     return statusCode;
   }
 
-  buildContentObjectType(script, statusCode, response) {
-    return `{
-      ${Object.keys(response.content ?? {})
-        .map(
-          (mediaType) =>
-            `"${mediaType}": { 
-              schema:  ${new SchemaTypeCoder(
-                this.requirement
-                  .get(statusCode)
-                  .get("content")
-                  .get(mediaType)
-                  .get("schema")
-              ).write(script)}
-            }`
-        )
-        .join(",\n")}
-    }`;
+  buildContentObjectType(script, response) {
+    if (!response.has("content")) {
+      return "{}";
+    }
+
+    return response.get("content").map((content, mediaType) => [
+      mediaType,
+      `{ 
+          schema:  ${new SchemaTypeCoder(content.get("schema")).write(script)}
+       }`,
+    ]);
   }
 
-  buildHeaders(script, responseCode) {
-    const response = this.requirement.get(responseCode);
+  printContentObjectType(script, response) {
+    if (!response.has("content")) {
+      return "{}";
+    }
 
-    const properties = Object.keys(response.data.headers ?? {}).map(
-      (name) =>
-        `"${name}": { schema: ${new SchemaTypeCoder(
-          response.get("headers").get(name).get("schema")
-        ).write(script)}}`
-    );
+    return printObject(this.buildContentObjectType(script, response));
+  }
 
-    return `{${properties.join(";")}}`;
+  buildHeaders(script, response) {
+    return response
+      .get("headers")
+      .map((value, name) => [
+        name,
+        `{ schema: ${new SchemaTypeCoder(value.get("schema")).write(script)}}`,
+      ]);
+  }
+
+  printHeaders(script, response) {
+    if (!response.has("headers")) {
+      return "{}";
+    }
+
+    return printObject(this.buildHeaders(script, response));
   }
 
   buildResponseObjectType(script) {
-    const responses = this.requirement.data;
-
-    return `{
-      ${Object.entries(responses)
-        .map(
-          ([responseCode, response]) => `${this.normalizeStatusCode(
-            responseCode,
-            responses
-          )}: {
-          headers: ${this.buildHeaders(script, responseCode)};
-          content: ${this.buildContentObjectType(
-            script,
-            responseCode,
-            response
-          )};
-        }`
-        )
-        .join(",")}
-      }`;
+    return printObjectWithoutQuotes(
+      this.requirement.map((response, responseCode) => [
+        this.normalizeStatusCode(responseCode),
+        `{
+          headers: ${this.printHeaders(script, response)};
+          content: ${this.printContentObjectType(script, response)};
+        }`,
+      ])
+    );
   }
 
   write(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 b0ea98e..921865b 100644
--- a/test/typescript-generator/__snapshots__/end-to-end.test.js.snap
+++ b/test/typescript-generator/__snapshots__/end-to-end.test.js.snap
@@ -52,23 +52,22 @@ Map {
           "exports": Map {
             "HTTP_POST" => Object {
               "code": "({ query, path, header, body, context }: { query: undefined, path: undefined, header: undefined, body: Pet, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  Pet
-            },
+\\"application/xml\\": { 
+          schema:  Pet
+       },
 \\"application/json\\": { 
-              schema:  Pet
-            }
-    };
-        },405: {
+          schema:  Pet
+       }
+};
+        },
+405: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: Pet
@@ -90,33 +89,30 @@ Map {
             },
             "HTTP_PUT" => Object {
               "code": "({ query, path, header, body, context }: { query: undefined, path: undefined, header: undefined, body: Pet, context: typeof Context2, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  Pet
-            },
+\\"application/xml\\": { 
+          schema:  Pet
+       },
 \\"application/json\\": { 
-              schema:  Pet
-            }
-    };
-        },400: {
+          schema:  Pet
+       }
+};
+        },
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
-        },405: {
+          content: {};
+        },
+405: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: Pet
@@ -329,23 +325,22 @@ Map {
           "exports": Map {
             "HTTP_POST" => Object {
               "code": "({ query, path, header, body, context }: { query: undefined, path: undefined, header: undefined, body: Pet, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  Pet
-            },
+\\"application/xml\\": { 
+          schema:  Pet
+       },
 \\"application/json\\": { 
-              schema:  Pet
-            }
-    };
-        },405: {
+          schema:  Pet
+       }
+};
+        },
+405: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: Pet
@@ -367,33 +362,30 @@ Map {
             },
             "HTTP_PUT" => Object {
               "code": "({ query, path, header, body, context }: { query: undefined, path: undefined, header: undefined, body: Pet, context: typeof Context2, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  Pet
-            },
+\\"application/xml\\": { 
+          schema:  Pet
+       },
 \\"application/json\\": { 
-              schema:  Pet
-            }
-    };
-        },400: {
+          schema:  Pet
+       }
+};
+        },
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
-        },405: {
+          content: {};
+        },
+405: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: Pet
@@ -610,23 +602,22 @@ Map {
     "exports": Map {
       "HTTP_POST" => Object {
         "code": "({ query, path, header, body, context }: { query: undefined, path: undefined, header: undefined, body: Pet, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  Pet
-            },
+\\"application/xml\\": { 
+          schema:  Pet
+       },
 \\"application/json\\": { 
-              schema:  Pet
-            }
-    };
-        },405: {
+          schema:  Pet
+       }
+};
+        },
+405: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: Pet
@@ -648,33 +639,30 @@ Map {
       },
       "HTTP_PUT" => Object {
         "code": "({ query, path, header, body, context }: { query: undefined, path: undefined, header: undefined, body: Pet, context: typeof Context2, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  Pet
-            },
+\\"application/xml\\": { 
+          schema:  Pet
+       },
 \\"application/json\\": { 
-              schema:  Pet
-            }
-    };
-        },400: {
+          schema:  Pet
+       }
+};
+        },
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
-        },405: {
+          content: {};
+        },
+405: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: Pet
@@ -905,23 +893,22 @@ Map {
           "exports": Map {
             "HTTP_GET" => Object {
               "code": "({ query, path, header, body, context }: { query: {status?: string}, path: never, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  Array<Pet>
-            },
+\\"application/xml\\": { 
+          schema:  Array<Pet>
+       },
 \\"application/json\\": { 
-              schema:  Array<Pet>
-            }
-    };
-        },400: {
+          schema:  Array<Pet>
+       }
+};
+        },
+400: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: Array<Pet>
@@ -1104,23 +1091,22 @@ Map {
     "exports": Map {
       "HTTP_GET" => Object {
         "code": "({ query, path, header, body, context }: { query: {status?: string}, path: never, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  Array<Pet>
-            },
+\\"application/xml\\": { 
+          schema:  Array<Pet>
+       },
 \\"application/json\\": { 
-              schema:  Array<Pet>
-            }
-    };
-        },400: {
+          schema:  Array<Pet>
+       }
+};
+        },
+400: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: Array<Pet>
@@ -1319,23 +1305,22 @@ Map {
           "exports": Map {
             "HTTP_GET" => Object {
               "code": "({ query, path, header, body, context }: { query: {tags?: Array<string>}, path: never, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  Array<Pet>
-            },
+\\"application/xml\\": { 
+          schema:  Array<Pet>
+       },
 \\"application/json\\": { 
-              schema:  Array<Pet>
-            }
-    };
-        },400: {
+          schema:  Array<Pet>
+       }
+};
+        },
+400: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: Array<Pet>
@@ -1518,23 +1503,22 @@ Map {
     "exports": Map {
       "HTTP_GET" => Object {
         "code": "({ query, path, header, body, context }: { query: {tags?: Array<string>}, path: never, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  Array<Pet>
-            },
+\\"application/xml\\": { 
+          schema:  Array<Pet>
+       },
 \\"application/json\\": { 
-              schema:  Array<Pet>
-            }
-    };
-        },400: {
+          schema:  Array<Pet>
+       }
+};
+        },
+400: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: Array<Pet>
@@ -1761,28 +1745,26 @@ Map {
           "exports": Map {
             "HTTP_GET" => Object {
               "code": "({ query, path, header, body, context }: { query: never, path: {petId: number}, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  Pet
-            },
+\\"application/xml\\": { 
+          schema:  Pet
+       },
 \\"application/json\\": { 
-              schema:  Pet
-            }
-    };
-        },400: {
+          schema:  Pet
+       }
+};
+        },
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: Pet
@@ -1806,13 +1788,11 @@ Map {
             },
             "HTTP_POST" => Object {
               "code": "({ query, path, header, body, context }: { query: {name?: number, status?: string}, path: {petId: number}, header: never, body: undefined, context: typeof Context2, response: ResponseBuilderFactory<{
-      405: {
+405: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 405 
           } | { status: 415, contentType: \\"text/plain\\", body: string }
     | void",
@@ -1826,13 +1806,11 @@ Map {
             },
             "HTTP_DELETE" => Object {
               "code": "({ query, path, header, body, context }: { query: never, path: {petId: string}, header: {api_key?: string}, body: undefined, context: typeof Context3, response: ResponseBuilderFactory<{
-      400: {
+400: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 400 
           } | { status: 415, contentType: \\"text/plain\\", body: string }
     | void",
@@ -2071,28 +2049,26 @@ Map {
           "exports": Map {
             "HTTP_GET" => Object {
               "code": "({ query, path, header, body, context }: { query: never, path: {petId: number}, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  Pet
-            },
+\\"application/xml\\": { 
+          schema:  Pet
+       },
 \\"application/json\\": { 
-              schema:  Pet
-            }
-    };
-        },400: {
+          schema:  Pet
+       }
+};
+        },
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: Pet
@@ -2116,13 +2092,11 @@ Map {
             },
             "HTTP_POST" => Object {
               "code": "({ query, path, header, body, context }: { query: {name?: number, status?: string}, path: {petId: number}, header: never, body: undefined, context: typeof Context2, response: ResponseBuilderFactory<{
-      405: {
+405: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 405 
           } | { status: 415, contentType: \\"text/plain\\", body: string }
     | void",
@@ -2136,13 +2110,11 @@ Map {
             },
             "HTTP_DELETE" => Object {
               "code": "({ query, path, header, body, context }: { query: never, path: {petId: string}, header: {api_key?: string}, body: undefined, context: typeof Context3, response: ResponseBuilderFactory<{
-      400: {
+400: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 400 
           } | { status: 415, contentType: \\"text/plain\\", body: string }
     | void",
@@ -2381,28 +2353,26 @@ Map {
           "exports": Map {
             "HTTP_GET" => Object {
               "code": "({ query, path, header, body, context }: { query: never, path: {petId: number}, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  Pet
-            },
+\\"application/xml\\": { 
+          schema:  Pet
+       },
 \\"application/json\\": { 
-              schema:  Pet
-            }
-    };
-        },400: {
+          schema:  Pet
+       }
+};
+        },
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: Pet
@@ -2426,13 +2396,11 @@ Map {
             },
             "HTTP_POST" => Object {
               "code": "({ query, path, header, body, context }: { query: {name?: number, status?: string}, path: {petId: number}, header: never, body: undefined, context: typeof Context2, response: ResponseBuilderFactory<{
-      405: {
+405: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 405 
           } | { status: 415, contentType: \\"text/plain\\", body: string }
     | void",
@@ -2446,13 +2414,11 @@ Map {
             },
             "HTTP_DELETE" => Object {
               "code": "({ query, path, header, body, context }: { query: never, path: {petId: string}, header: {api_key?: string}, body: undefined, context: typeof Context3, response: ResponseBuilderFactory<{
-      400: {
+400: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 400 
           } | { status: 415, contentType: \\"text/plain\\", body: string }
     | void",
@@ -2695,28 +2661,26 @@ Map {
     "exports": Map {
       "HTTP_GET" => Object {
         "code": "({ query, path, header, body, context }: { query: never, path: {petId: number}, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  Pet
-            },
+\\"application/xml\\": { 
+          schema:  Pet
+       },
 \\"application/json\\": { 
-              schema:  Pet
-            }
-    };
-        },400: {
+          schema:  Pet
+       }
+};
+        },
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: Pet
@@ -2740,13 +2704,11 @@ Map {
       },
       "HTTP_POST" => Object {
         "code": "({ query, path, header, body, context }: { query: {name?: number, status?: string}, path: {petId: number}, header: never, body: undefined, context: typeof Context2, response: ResponseBuilderFactory<{
-      405: {
+405: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 405 
           } | { status: 415, contentType: \\"text/plain\\", body: string }
     | void",
@@ -2760,13 +2722,11 @@ Map {
       },
       "HTTP_DELETE" => Object {
         "code": "({ query, path, header, body, context }: { query: never, path: {petId: string}, header: {api_key?: string}, body: undefined, context: typeof Context3, response: ResponseBuilderFactory<{
-      400: {
+400: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 400 
           } | { status: 415, contentType: \\"text/plain\\", body: string }
     | void",
@@ -3021,15 +2981,15 @@ Map {
           "exports": Map {
             "HTTP_POST" => Object {
               "code": "({ query, path, header, body, context }: { query: {additionalMetadata?: number}, path: {petId: number}, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/json\\": { 
-              schema:  ApiResponse
-            }
-    };
+\\"application/json\\": { 
+          schema:  ApiResponse
+       }
+};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/json\\",
             body?: ApiResponse
@@ -3143,15 +3103,15 @@ Map {
     "exports": Map {
       "HTTP_POST" => Object {
         "code": "({ query, path, header, body, context }: { query: {additionalMetadata?: number}, path: {petId: number}, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/json\\": { 
-              schema:  ApiResponse
-            }
-    };
+\\"application/json\\": { 
+          schema:  ApiResponse
+       }
+};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/json\\",
             body?: ApiResponse
@@ -3280,15 +3240,15 @@ Map {
           "exports": Map {
             "HTTP_GET" => Object {
               "code": "({ query, path, header, body, context }: { query: undefined, path: undefined, header: undefined, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/json\\": { 
-              schema:  {[key: string]: number}
-            }
-    };
+\\"application/json\\": { 
+          schema:  {[key: string]: number}
+       }
+};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/json\\",
             body?: {[key: string]: number}
@@ -3371,15 +3331,15 @@ Map {
     "exports": Map {
       "HTTP_GET" => Object {
         "code": "({ query, path, header, body, context }: { query: undefined, path: undefined, header: undefined, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/json\\": { 
-              schema:  {[key: string]: number}
-            }
-    };
+\\"application/json\\": { 
+          schema:  {[key: string]: number}
+       }
+};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/json\\",
             body?: {[key: string]: number}
@@ -3479,20 +3439,19 @@ Map {
           "exports": Map {
             "HTTP_POST" => Object {
               "code": "({ query, path, header, body, context }: { query: undefined, path: undefined, header: undefined, body: Order, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/json\\": { 
-              schema:  Order
-            }
-    };
-        },405: {
+\\"application/json\\": { 
+          schema:  Order
+       }
+};
+        },
+405: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/json\\",
             body?: Order
@@ -3608,20 +3567,19 @@ Map {
     "exports": Map {
       "HTTP_POST" => Object {
         "code": "({ query, path, header, body, context }: { query: undefined, path: undefined, header: undefined, body: Order, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/json\\": { 
-              schema:  Order
-            }
-    };
-        },405: {
+\\"application/json\\": { 
+          schema:  Order
+       }
+};
+        },
+405: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/json\\",
             body?: Order
@@ -3767,28 +3725,26 @@ Map {
           "exports": Map {
             "HTTP_GET" => Object {
               "code": "({ query, path, header, body, context }: { query: never, path: {orderId: number}, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  Order
-            },
+\\"application/xml\\": { 
+          schema:  Order
+       },
 \\"application/json\\": { 
-              schema:  Order
-            }
-    };
-        },400: {
+          schema:  Order
+       }
+};
+        },
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: Order
@@ -3812,18 +3768,15 @@ Map {
             },
             "HTTP_DELETE" => Object {
               "code": "({ query, path, header, body, context }: { query: never, path: {orderId: number}, header: never, body: undefined, context: typeof Context2, response: ResponseBuilderFactory<{
-      400: {
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 400 
           } | {  
             status: 404 
@@ -3967,28 +3920,26 @@ Map {
           "exports": Map {
             "HTTP_GET" => Object {
               "code": "({ query, path, header, body, context }: { query: never, path: {orderId: number}, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  Order
-            },
+\\"application/xml\\": { 
+          schema:  Order
+       },
 \\"application/json\\": { 
-              schema:  Order
-            }
-    };
-        },400: {
+          schema:  Order
+       }
+};
+        },
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: Order
@@ -4012,18 +3963,15 @@ Map {
             },
             "HTTP_DELETE" => Object {
               "code": "({ query, path, header, body, context }: { query: never, path: {orderId: number}, header: never, body: undefined, context: typeof Context2, response: ResponseBuilderFactory<{
-      400: {
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 400 
           } | {  
             status: 404 
@@ -4171,28 +4119,26 @@ Map {
     "exports": Map {
       "HTTP_GET" => Object {
         "code": "({ query, path, header, body, context }: { query: never, path: {orderId: number}, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  Order
-            },
+\\"application/xml\\": { 
+          schema:  Order
+       },
 \\"application/json\\": { 
-              schema:  Order
-            }
-    };
-        },400: {
+          schema:  Order
+       }
+};
+        },
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: Order
@@ -4216,18 +4162,15 @@ Map {
       },
       "HTTP_DELETE" => Object {
         "code": "({ query, path, header, body, context }: { query: never, path: {orderId: number}, header: never, body: undefined, context: typeof Context2, response: ResponseBuilderFactory<{
-      400: {
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 400 
           } | {  
             status: 404 
@@ -4389,18 +4332,18 @@ Map {
           "exports": Map {
             "HTTP_POST" => Object {
               "code": "({ query, path, header, body, context }: { query: undefined, path: undefined, header: undefined, body: User, context: typeof Context, response: ResponseBuilderFactory<{
-      [statusCode in HttpStatusCode]: {
+[statusCode in HttpStatusCode]: {
           headers: {};
           content: {
-      \\"application/json\\": { 
-              schema:  User
-            },
+\\"application/json\\": { 
+          schema:  User
+       },
 \\"application/xml\\": { 
-              schema:  User
-            }
-    };
+          schema:  User
+       }
+};
         }
-      }> }) => {  
+}> }) => {  
             status: number | undefined, 
             contentType?: \\"application/json\\",
             body?: User
@@ -4516,18 +4459,18 @@ Map {
     "exports": Map {
       "HTTP_POST" => Object {
         "code": "({ query, path, header, body, context }: { query: undefined, path: undefined, header: undefined, body: User, context: typeof Context, response: ResponseBuilderFactory<{
-      [statusCode in HttpStatusCode]: {
+[statusCode in HttpStatusCode]: {
           headers: {};
           content: {
-      \\"application/json\\": { 
-              schema:  User
-            },
+\\"application/json\\": { 
+          schema:  User
+       },
 \\"application/xml\\": { 
-              schema:  User
-            }
-    };
+          schema:  User
+       }
+};
         }
-      }> }) => {  
+}> }) => {  
             status: number | undefined, 
             contentType?: \\"application/json\\",
             body?: User
@@ -4659,23 +4602,22 @@ Map {
           "exports": Map {
             "HTTP_POST" => Object {
               "code": "({ query, path, header, body, context }: { query: undefined, path: undefined, header: undefined, body: Array<User>, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  User
-            },
+\\"application/xml\\": { 
+          schema:  User
+       },
 \\"application/json\\": { 
-              schema:  User
-            }
-    };
-        },[statusCode in Exclude<HttpStatusCode, 200>]: {
+          schema:  User
+       }
+};
+        },
+[statusCode in Exclude<HttpStatusCode, 200>]: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: User
@@ -4795,23 +4737,22 @@ Map {
     "exports": Map {
       "HTTP_POST" => Object {
         "code": "({ query, path, header, body, context }: { query: undefined, path: undefined, header: undefined, body: Array<User>, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  User
-            },
+\\"application/xml\\": { 
+          schema:  User
+       },
 \\"application/json\\": { 
-              schema:  User
-            }
-    };
-        },[statusCode in Exclude<HttpStatusCode, 200>]: {
+          schema:  User
+       }
+};
+        },
+[statusCode in Exclude<HttpStatusCode, 200>]: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: User
@@ -4946,23 +4887,25 @@ Map {
           "exports": Map {
             "HTTP_GET" => Object {
               "code": "({ query, path, header, body, context }: { query: {username?: string, password?: string}, path: never, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
-          headers: {\\"X-Rate-Limit\\": { schema: number};\\"X-Expires-After\\": { schema: string}};
+200: {
+          headers: {
+\\"X-Rate-Limit\\": { schema: number},
+\\"X-Expires-After\\": { schema: string}
+};
           content: {
-      \\"application/xml\\": { 
-              schema:  string
-            },
+\\"application/xml\\": { 
+          schema:  string
+       },
 \\"application/json\\": { 
-              schema:  string
-            }
-    };
-        },400: {
+          schema:  string
+       }
+};
+        },
+400: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: string
@@ -5051,23 +4994,25 @@ Map {
     "exports": Map {
       "HTTP_GET" => Object {
         "code": "({ query, path, header, body, context }: { query: {username?: string, password?: string}, path: never, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
-          headers: {\\"X-Rate-Limit\\": { schema: number};\\"X-Expires-After\\": { schema: string}};
+200: {
+          headers: {
+\\"X-Rate-Limit\\": { schema: number},
+\\"X-Expires-After\\": { schema: string}
+};
           content: {
-      \\"application/xml\\": { 
-              schema:  string
-            },
+\\"application/xml\\": { 
+          schema:  string
+       },
 \\"application/json\\": { 
-              schema:  string
-            }
-    };
-        },400: {
+          schema:  string
+       }
+};
+        },
+400: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: string
@@ -5170,13 +5115,11 @@ Map {
           "exports": Map {
             "HTTP_GET" => Object {
               "code": "({ query, path, header, body, context }: { query: never, path: never, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      [statusCode in HttpStatusCode]: {
+[statusCode in HttpStatusCode]: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: number | undefined 
           } | { status: 415, contentType: \\"text/plain\\", body: string }
     | void",
@@ -5257,13 +5200,11 @@ Map {
     "exports": Map {
       "HTTP_GET" => Object {
         "code": "({ query, path, header, body, context }: { query: never, path: never, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      [statusCode in HttpStatusCode]: {
+[statusCode in HttpStatusCode]: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: number | undefined 
           } | { status: 415, contentType: \\"text/plain\\", body: string }
     | void",
@@ -5389,28 +5330,26 @@ Map {
           "exports": Map {
             "HTTP_GET" => Object {
               "code": "({ query, path, header, body, context }: { query: never, path: {username: string}, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  User
-            },
+\\"application/xml\\": { 
+          schema:  User
+       },
 \\"application/json\\": { 
-              schema:  User
-            }
-    };
-        },400: {
+          schema:  User
+       }
+};
+        },
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: User
@@ -5434,13 +5373,11 @@ Map {
             },
             "HTTP_PUT" => Object {
               "code": "({ query, path, header, body, context }: { query: never, path: {username: string}, header: never, body: User, context: typeof Context2, response: ResponseBuilderFactory<{
-      [statusCode in HttpStatusCode]: {
+[statusCode in HttpStatusCode]: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: number | undefined 
           } | { status: 415, contentType: \\"text/plain\\", body: string }
     | void",
@@ -5454,18 +5391,15 @@ Map {
             },
             "HTTP_DELETE" => Object {
               "code": "({ query, path, header, body, context }: { query: never, path: {username: string}, header: never, body: undefined, context: typeof Context3, response: ResponseBuilderFactory<{
-      400: {
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 400 
           } | {  
             status: 404 
@@ -5643,28 +5577,26 @@ Map {
           "exports": Map {
             "HTTP_GET" => Object {
               "code": "({ query, path, header, body, context }: { query: never, path: {username: string}, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  User
-            },
+\\"application/xml\\": { 
+          schema:  User
+       },
 \\"application/json\\": { 
-              schema:  User
-            }
-    };
-        },400: {
+          schema:  User
+       }
+};
+        },
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: User
@@ -5688,13 +5620,11 @@ Map {
             },
             "HTTP_PUT" => Object {
               "code": "({ query, path, header, body, context }: { query: never, path: {username: string}, header: never, body: User, context: typeof Context2, response: ResponseBuilderFactory<{
-      [statusCode in HttpStatusCode]: {
+[statusCode in HttpStatusCode]: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: number | undefined 
           } | { status: 415, contentType: \\"text/plain\\", body: string }
     | void",
@@ -5708,18 +5638,15 @@ Map {
             },
             "HTTP_DELETE" => Object {
               "code": "({ query, path, header, body, context }: { query: never, path: {username: string}, header: never, body: undefined, context: typeof Context3, response: ResponseBuilderFactory<{
-      400: {
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 400 
           } | {  
             status: 404 
@@ -5897,28 +5824,26 @@ Map {
           "exports": Map {
             "HTTP_GET" => Object {
               "code": "({ query, path, header, body, context }: { query: never, path: {username: string}, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  User
-            },
+\\"application/xml\\": { 
+          schema:  User
+       },
 \\"application/json\\": { 
-              schema:  User
-            }
-    };
-        },400: {
+          schema:  User
+       }
+};
+        },
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: User
@@ -5942,13 +5867,11 @@ Map {
             },
             "HTTP_PUT" => Object {
               "code": "({ query, path, header, body, context }: { query: never, path: {username: string}, header: never, body: User, context: typeof Context2, response: ResponseBuilderFactory<{
-      [statusCode in HttpStatusCode]: {
+[statusCode in HttpStatusCode]: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: number | undefined 
           } | { status: 415, contentType: \\"text/plain\\", body: string }
     | void",
@@ -5962,18 +5885,15 @@ Map {
             },
             "HTTP_DELETE" => Object {
               "code": "({ query, path, header, body, context }: { query: never, path: {username: string}, header: never, body: undefined, context: typeof Context3, response: ResponseBuilderFactory<{
-      400: {
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 400 
           } | {  
             status: 404 
@@ -6155,28 +6075,26 @@ Map {
     "exports": Map {
       "HTTP_GET" => Object {
         "code": "({ query, path, header, body, context }: { query: never, path: {username: string}, header: never, body: undefined, context: typeof Context, response: ResponseBuilderFactory<{
-      200: {
+200: {
           headers: {};
           content: {
-      \\"application/xml\\": { 
-              schema:  User
-            },
+\\"application/xml\\": { 
+          schema:  User
+       },
 \\"application/json\\": { 
-              schema:  User
-            }
-    };
-        },400: {
+          schema:  User
+       }
+};
+        },
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 200, 
             contentType?: \\"application/xml\\",
             body?: User
@@ -6200,13 +6118,11 @@ Map {
       },
       "HTTP_PUT" => Object {
         "code": "({ query, path, header, body, context }: { query: never, path: {username: string}, header: never, body: User, context: typeof Context2, response: ResponseBuilderFactory<{
-      [statusCode in HttpStatusCode]: {
+[statusCode in HttpStatusCode]: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: number | undefined 
           } | { status: 415, contentType: \\"text/plain\\", body: string }
     | void",
@@ -6220,18 +6136,15 @@ Map {
       },
       "HTTP_DELETE" => Object {
         "code": "({ query, path, header, body, context }: { query: never, path: {username: string}, header: never, body: undefined, context: typeof Context3, response: ResponseBuilderFactory<{
-      400: {
+400: {
           headers: {};
-          content: {
-      
-    };
-        },404: {
+          content: {};
+        },
+404: {
           headers: {};
-          content: {
-      
-    };
+          content: {};
         }
-      }> }) => {  
+}> }) => {  
             status: 400 
           } | {  
             status: 404 
diff --git a/test/typescript-generator/integration.test.js b/test/typescript-generator/integration.test.js
index 2d02e44..1938030 100644
--- a/test/typescript-generator/integration.test.js
+++ b/test/typescript-generator/integration.test.js
@@ -35,8 +35,8 @@ describe("integration Test", () => {
       }
     }
 
-    requirement.forEach(([key, pathDefinition]) => {
-      pathDefinition.forEach(([, operation]) => {
+    requirement.forEach((pathDefinition, key) => {
+      pathDefinition.forEach((operation) => {
         repository.get(`paths${key}.ts`).export(new OperationCoder(operation));
       });
     });
diff --git a/test/typescript-generator/requirement.test.js b/test/typescript-generator/requirement.test.js
index afbdc94..0059d29 100644
--- a/test/typescript-generator/requirement.test.js
+++ b/test/typescript-generator/requirement.test.js
@@ -61,8 +61,8 @@ describe("a Requirement", () => {
 
     const result = [];
 
-    requirement.forEach((entry) => {
-      result.push(entry);
+    requirement.forEach((value, key) => {
+      result.push([key, value]);
     });
 
     expect(result).toStrictEqual([
@@ -83,7 +83,7 @@ describe("a Requirement", () => {
     const address = requirement.select("address");
     const specialChars = requirement.select("foo~1bar~0baz");
 
-    const result = requirement.map(([key, subRequirement]) => [
+    const result = requirement.map((subRequirement, key) => [
       `${key}!`,
       subRequirement,
     ]);
@@ -102,7 +102,7 @@ describe("a Requirement", () => {
       b: "bar",
     });
 
-    const result = requirement.flatMap(([key, subRequirement]) => [
+    const result = requirement.flatMap((subRequirement, key) => [
       `${key}: ${subRequirement.data} 1`,
 
       `${key}: ${subRequirement.data} 2`,
diff --git a/test/typescript-generator/response-type-coder.test.js b/test/typescript-generator/response-type-coder.test.js
index 514ac95..44fff27 100644
--- a/test/typescript-generator/response-type-coder.test.js
+++ b/test/typescript-generator/response-type-coder.test.js
@@ -2,14 +2,41 @@ import { ResponseTypeCoder } from "../../src/typescript-generator/response-type-
 
 describe("a ResponseTypeCoder", () => {
   it("creates a type for a status code", () => {
-    const coder = new ResponseTypeCoder();
+    const coder = new ResponseTypeCoder({
+      data: {
+        200: {},
+        default: {},
+      },
+    });
 
-    expect(coder.normalizeStatusCode("200", { default: {} })).toBe("200");
-    expect(coder.normalizeStatusCode("default", { default: {} })).toBe(
-      "[statusCode in HttpStatusCode]"
+    expect(coder.normalizeStatusCode("200", { 200: {}, default: {} })).toBe(
+      "200"
     );
+  });
+
+  it("creates a type for a default status code when some status codes are defined", () => {
+    const coder = new ResponseTypeCoder({
+      data: {
+        default: {},
+        200: {},
+        201: {},
+      },
+    });
+
     expect(coder.normalizeStatusCode("default", { 200: {}, 201: {} })).toBe(
       "[statusCode in Exclude<HttpStatusCode, 200 | 201>]"
     );
   });
+
+  it("creates a type for a default status code when its the only entry, so it could represent any status code", () => {
+    const coder = new ResponseTypeCoder({
+      data: {
+        default: {},
+      },
+    });
+
+    expect(coder.normalizeStatusCode("default", { default: {} })).toBe(
+      "[statusCode in HttpStatusCode]"
+    );
+  });
 });