two-stroke 5.0.0 → 5.0.2

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.
package/package.json CHANGED
@@ -49,7 +49,7 @@
49
49
  "name": "two-stroke",
50
50
  "packageManager": "yarn@4.6.0",
51
51
  "type": "module",
52
- "version": "5.0.0",
52
+ "version": "5.0.2",
53
53
  "devDependencies": {
54
54
  "@types/eslint": "^9.6.1",
55
55
  "eslint": "^9.27.0",
package/src/index.ts CHANGED
@@ -120,7 +120,8 @@ export function twoStroke<T extends Env>(title: string, release: string) {
120
120
  return new Response(
121
121
  JSON.stringify({
122
122
  error: "Request body schema invalid",
123
- ...body.error,
123
+ issues: JSON.parse(body.error?.message ?? "{}") as unknown,
124
+ name: body.error?.name
124
125
  }),
125
126
  {
126
127
  status: 400,
package/src/open-api.ts CHANGED
@@ -35,7 +35,7 @@ export const openAPI =
35
35
  ).map(([k, v]) => ({
36
36
  name: k,
37
37
  in: "query",
38
- requireed: !v.safeParse(undefined).success,
38
+ required: !v.safeParse(undefined).success,
39
39
  schema: z.toJSONSchema(v, { io: "input" }),
40
40
  })),
41
41
  ...Array.from(
@@ -56,9 +56,11 @@ export const openAPI =
56
56
  requestBody: {
57
57
  required: true,
58
58
  content: {
59
- "application/json": {
60
- schema: z.toJSONSchema(r.input!, { io: "input" }),
61
- },
59
+ "application/json": r.input
60
+ ? {
61
+ schema: z.toJSONSchema(r.input, { io: "input" }),
62
+ }
63
+ : undefined,
62
64
  },
63
65
  },
64
66
  }