Skip to content

Commit b5fb44a

Browse files
committed
chore: clean
1 parent 6085140 commit b5fb44a

File tree

8 files changed

+11
-455
lines changed

8 files changed

+11
-455
lines changed

ERROR_HANDLING.md

Lines changed: 0 additions & 143 deletions
This file was deleted.

error-handling-example.ts

Lines changed: 0 additions & 82 deletions
This file was deleted.

packages/typed-openapi/src/generator.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ const replacerByRuntime = {
6767
};
6868

6969
export const generateFile = (options: GeneratorOptions) => {
70-
const ctx = {
71-
...options,
70+
const ctx = {
71+
...options,
7272
runtime: options.runtime ?? "none",
7373
successStatusCodes: options.successStatusCodes ?? DEFAULT_SUCCESS_STATUS_CODES
7474
} as GeneratorContext;
@@ -337,7 +337,7 @@ export type Fetcher = (method: Method, url: string, parameters?: EndpointParamet
337337
export type StatusCode = ${statusCodeType};
338338
339339
// Error handling types
340-
export type ApiResponse<TSuccess, TAllResponses extends Record<string | number, unknown> = {}> =
340+
export type ApiResponse<TSuccess, TAllResponses extends Record<string | number, unknown> = {}> =
341341
(keyof TAllResponses extends never
342342
? {
343343
ok: true;

packages/typed-openapi/tests/configurable-status-codes.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ it("should use custom success status codes", async () => {
2323
}
2424
},
2525
201: {
26-
description: "Created",
26+
description: "Created",
2727
content: {
2828
"application/json": {
2929
schema: { type: "object", properties: { id: { type: "string" } } }
@@ -45,23 +45,23 @@ it("should use custom success status codes", async () => {
4545
};
4646

4747
const endpoints = mapOpenApiEndpoints(openApiDoc);
48-
48+
4949
// Test with default success status codes (should include 200 and 201)
5050
const defaultGenerated = await prettify(generateFile(endpoints));
5151
expect(defaultGenerated).toContain("export type StatusCode =");
5252
expect(defaultGenerated).toContain("| 200");
5353
expect(defaultGenerated).toContain("| 201");
54-
54+
5555
// Test with custom success status codes (only 200)
5656
const customGenerated = await prettify(generateFile({
5757
...endpoints,
5858
successStatusCodes: [200] as const
5959
}));
60-
60+
6161
// Should only contain 200 in the StatusCode type
6262
expect(customGenerated).toContain("export type StatusCode = 200;");
6363
expect(customGenerated).not.toContain("| 201");
64-
64+
6565
// The ApiResponse type should use the custom StatusCode
6666
expect(customGenerated).toContain("TStatusCode extends StatusCode");
6767
});

packages/typed-openapi/tests/multiple-success-responses.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe("multiple success responses", () => {
7575
type: "object",
7676
properties: {
7777
message: { type: "string" },
78-
errors: {
78+
errors: {
7979
type: "array",
8080
items: { type: "string" }
8181
}
@@ -96,12 +96,12 @@ describe("multiple success responses", () => {
9696

9797
// Check that the endpoint has proper response types
9898
expect(generated).toContain("post_CreateOrUpdateUser");
99-
99+
100100
// Check that different success responses have different schemas
101101
expect(generated).toContain("updated: boolean");
102102
expect(generated).toContain("created: boolean");
103103
expect(generated).toContain("Array<string>");
104-
104+
105105
// Verify the SafeApiResponse type is present for error handling
106106
expect(generated).toContain("SafeApiResponse");
107107

test-complete-api.ts

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)