snap-on-openapi 1.0.11 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,7 +41,12 @@ export class ExpressWrapper {
41
41
  for (const header of Object.entries(result.headers)) {
42
42
  res.header(header[0], header[1]);
43
43
  }
44
- res.json(result.body);
44
+ if (result.body instanceof Buffer) {
45
+ res.send(result.body);
46
+ }
47
+ else {
48
+ res.json(result.body);
49
+ }
45
50
  };
46
51
  const regex = new RegExp(`${route}.*`);
47
52
  expressApp.get(regex, handler);
@@ -2,5 +2,5 @@ export interface ExpressResponse {
2
2
  header: (name: string, value: string) => ExpressResponse;
3
3
  status: (code: number) => ExpressResponse;
4
4
  json: (data: unknown) => ExpressResponse;
5
- send: (body: string) => ExpressResponse;
5
+ send: (body: string | Buffer) => ExpressResponse;
6
6
  }
@@ -51,7 +51,8 @@ export class TanstackStartWrapper {
51
51
  getOpenApiRootMethods() {
52
52
  const processor = async (ctx) => {
53
53
  const response = await this.service.processRootRoute(ctx.request);
54
- const res = new Response(JSON.stringify(response.body), {
54
+ const body = response.body instanceof Buffer ? response.body : JSON.stringify(response.body);
55
+ const res = new Response(body, {
55
56
  status: response.status,
56
57
  headers: response.headers,
57
58
  });
@@ -16,4 +16,4 @@ export const stringDateTransformer = z.union([
16
16
  .transform((x) => {
17
17
  return new Date(Date.parse(x));
18
18
  }),
19
- ]).openapi({ type: 'string', format: 'date-time' });
19
+ ]).openapi({ type: 'string', format: 'date' });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "snap-on-openapi",
3
3
  "author": "Alex Sarychev",
4
- "version": "1.0.11",
4
+ "version": "1.0.12",
5
5
  "description": "Swiftly build type-checked OpenAPI applications with Zod and TypeScript",
6
6
  "type": "module",
7
7
  "license": "ISC",