@efebia/fastify-zod-reply 1.4.1 → 1.4.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/lib/cjs/routeV4.d.ts +3 -0
- package/lib/cjs/routeV4.js +2 -2
- package/lib/cjs/sseRouteV4.d.ts +3 -0
- package/lib/cjs/sseRouteV4.js +2 -2
- package/lib/esm/routeV4.d.ts +3 -0
- package/lib/esm/routeV4.js +2 -2
- package/lib/esm/sseRouteV4.d.ts +3 -0
- package/lib/esm/sseRouteV4.js +2 -2
- package/package.json +1 -1
package/lib/cjs/routeV4.d.ts
CHANGED
|
@@ -10,6 +10,9 @@ export type BaseZodV4Schema = {
|
|
|
10
10
|
}>;
|
|
11
11
|
Security?: RouteSecurity[keyof RouteSecurity][];
|
|
12
12
|
Tags?: (keyof RouteTag)[];
|
|
13
|
+
Description?: string;
|
|
14
|
+
Summary?: string;
|
|
15
|
+
Notes?: string;
|
|
13
16
|
};
|
|
14
17
|
export type FastifyZodV4Schema<TZodSchema extends BaseZodV4Schema> = {
|
|
15
18
|
Body: TZodSchema["Body"] extends z.ZodTypeAny ? z.output<TZodSchema["Body"]> : undefined;
|
package/lib/cjs/routeV4.js
CHANGED
|
@@ -6,7 +6,7 @@ const error_js_1 = require("./error.js");
|
|
|
6
6
|
const routeHelpers_js_1 = require("./routeHelpers.js");
|
|
7
7
|
const createRouteV4 = ({ strict: globalStrict = false } = {}) => (schema, handler, options) => {
|
|
8
8
|
const strict = typeof (options === null || options === void 0 ? void 0 : options.strict) !== "undefined" ? options === null || options === void 0 ? void 0 : options.strict : globalStrict;
|
|
9
|
-
const finalResult = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (schema.Body && {
|
|
9
|
+
const finalResult = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (schema.Body && {
|
|
10
10
|
body: v4_1.z.toJSONSchema((0, routeHelpers_js_1.strictifySchema)(schema.Body, (0, routeHelpers_js_1.parseStrict)("body", strict)), { reused: "inline", target: "draft-7", io: "input" }),
|
|
11
11
|
})), (schema.Params && {
|
|
12
12
|
params: v4_1.z.toJSONSchema((0, routeHelpers_js_1.strictifySchema)(schema.Params, (0, routeHelpers_js_1.parseStrict)("params", strict)), { reused: "inline", target: "draft-7", io: "input" }),
|
|
@@ -17,7 +17,7 @@ const createRouteV4 = ({ strict: globalStrict = false } = {}) => (schema, handle
|
|
|
17
17
|
})), { response: v4_1.z.toJSONSchema(schema.Reply.partial(), {
|
|
18
18
|
reused: "inline",
|
|
19
19
|
target: "draft-7",
|
|
20
|
-
})["properties"] }), (schema.Security && { security: schema.Security })), (schema.Tags && { tags: schema.Tags }));
|
|
20
|
+
})["properties"] }), (schema.Security && { security: schema.Security })), (schema.Tags && { tags: schema.Tags })), (schema.Description && { description: schema.Description })), (schema.Summary && { summary: schema.Summary })), (schema.Notes && { notes: schema.Notes }));
|
|
21
21
|
return {
|
|
22
22
|
schema: finalResult,
|
|
23
23
|
handler,
|
package/lib/cjs/sseRouteV4.d.ts
CHANGED
|
@@ -17,6 +17,9 @@ export type SSEBaseZodV4Schema = {
|
|
|
17
17
|
}>;
|
|
18
18
|
Security?: RouteSecurity[keyof RouteSecurity][];
|
|
19
19
|
Tags?: (keyof RouteTag)[];
|
|
20
|
+
Description?: string;
|
|
21
|
+
Summary?: string;
|
|
22
|
+
Notes?: string;
|
|
20
23
|
};
|
|
21
24
|
type TransformSSETo200<T> = {
|
|
22
25
|
[K in keyof T as K extends "SSE" ? 200 : K]: T[K];
|
package/lib/cjs/sseRouteV4.js
CHANGED
|
@@ -22,7 +22,7 @@ function createSSERouteV4(globalOptions = {}) {
|
|
|
22
22
|
throw new Error("An SSE endpoint must define a schema for the 200 status code.");
|
|
23
23
|
}
|
|
24
24
|
delete responseJsonSchema["SSE"];
|
|
25
|
-
const finalResult = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (schema.Body && {
|
|
25
|
+
const finalResult = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (schema.Body && {
|
|
26
26
|
body: v4_1.z.toJSONSchema((0, routeHelpers_js_1.strictifySchema)(schema.Body, (0, routeHelpers_js_1.parseStrict)("body", strict)), {
|
|
27
27
|
reused: "inline",
|
|
28
28
|
target: "draft-7",
|
|
@@ -52,7 +52,7 @@ function createSSERouteV4(globalOptions = {}) {
|
|
|
52
52
|
schema: responseSSESchema,
|
|
53
53
|
},
|
|
54
54
|
},
|
|
55
|
-
} }) }), (schema.Security && { security: schema.Security })), (schema.Tags && { tags: schema.Tags }));
|
|
55
|
+
} }) }), (schema.Security && { security: schema.Security })), (schema.Tags && { tags: schema.Tags })), (schema.Description && { description: schema.Description })), (schema.Summary && { summary: schema.Summary })), (schema.Notes && { notes: schema.Notes }));
|
|
56
56
|
return {
|
|
57
57
|
schema: finalResult,
|
|
58
58
|
handler,
|
package/lib/esm/routeV4.d.ts
CHANGED
|
@@ -10,6 +10,9 @@ export type BaseZodV4Schema = {
|
|
|
10
10
|
}>;
|
|
11
11
|
Security?: RouteSecurity[keyof RouteSecurity][];
|
|
12
12
|
Tags?: (keyof RouteTag)[];
|
|
13
|
+
Description?: string;
|
|
14
|
+
Summary?: string;
|
|
15
|
+
Notes?: string;
|
|
13
16
|
};
|
|
14
17
|
export type FastifyZodV4Schema<TZodSchema extends BaseZodV4Schema> = {
|
|
15
18
|
Body: TZodSchema["Body"] extends z.ZodTypeAny ? z.output<TZodSchema["Body"]> : undefined;
|
package/lib/esm/routeV4.js
CHANGED
|
@@ -3,7 +3,7 @@ import { FastifyZodReplyError } from "./error.js";
|
|
|
3
3
|
import { findStatusCode, mapZodError, parse, parseStrict, strictifySchema, } from "./routeHelpers.js";
|
|
4
4
|
export const createRouteV4 = ({ strict: globalStrict = false } = {}) => (schema, handler, options) => {
|
|
5
5
|
const strict = typeof (options === null || options === void 0 ? void 0 : options.strict) !== "undefined" ? options === null || options === void 0 ? void 0 : options.strict : globalStrict;
|
|
6
|
-
const finalResult = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (schema.Body && {
|
|
6
|
+
const finalResult = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (schema.Body && {
|
|
7
7
|
body: z.toJSONSchema(strictifySchema(schema.Body, parseStrict("body", strict)), { reused: "inline", target: "draft-7", io: "input" }),
|
|
8
8
|
})), (schema.Params && {
|
|
9
9
|
params: z.toJSONSchema(strictifySchema(schema.Params, parseStrict("params", strict)), { reused: "inline", target: "draft-7", io: "input" }),
|
|
@@ -14,7 +14,7 @@ export const createRouteV4 = ({ strict: globalStrict = false } = {}) => (schema,
|
|
|
14
14
|
})), { response: z.toJSONSchema(schema.Reply.partial(), {
|
|
15
15
|
reused: "inline",
|
|
16
16
|
target: "draft-7",
|
|
17
|
-
})["properties"] }), (schema.Security && { security: schema.Security })), (schema.Tags && { tags: schema.Tags }));
|
|
17
|
+
})["properties"] }), (schema.Security && { security: schema.Security })), (schema.Tags && { tags: schema.Tags })), (schema.Description && { description: schema.Description })), (schema.Summary && { summary: schema.Summary })), (schema.Notes && { notes: schema.Notes }));
|
|
18
18
|
return {
|
|
19
19
|
schema: finalResult,
|
|
20
20
|
handler,
|
package/lib/esm/sseRouteV4.d.ts
CHANGED
|
@@ -17,6 +17,9 @@ export type SSEBaseZodV4Schema = {
|
|
|
17
17
|
}>;
|
|
18
18
|
Security?: RouteSecurity[keyof RouteSecurity][];
|
|
19
19
|
Tags?: (keyof RouteTag)[];
|
|
20
|
+
Description?: string;
|
|
21
|
+
Summary?: string;
|
|
22
|
+
Notes?: string;
|
|
20
23
|
};
|
|
21
24
|
type TransformSSETo200<T> = {
|
|
22
25
|
[K in keyof T as K extends "SSE" ? 200 : K]: T[K];
|
package/lib/esm/sseRouteV4.js
CHANGED
|
@@ -18,7 +18,7 @@ export function createSSERouteV4(globalOptions = {}) {
|
|
|
18
18
|
throw new Error("An SSE endpoint must define a schema for the 200 status code.");
|
|
19
19
|
}
|
|
20
20
|
delete responseJsonSchema["SSE"];
|
|
21
|
-
const finalResult = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (schema.Body && {
|
|
21
|
+
const finalResult = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (schema.Body && {
|
|
22
22
|
body: z.toJSONSchema(strictifySchema(schema.Body, parseStrict("body", strict)), {
|
|
23
23
|
reused: "inline",
|
|
24
24
|
target: "draft-7",
|
|
@@ -48,7 +48,7 @@ export function createSSERouteV4(globalOptions = {}) {
|
|
|
48
48
|
schema: responseSSESchema,
|
|
49
49
|
},
|
|
50
50
|
},
|
|
51
|
-
} }) }), (schema.Security && { security: schema.Security })), (schema.Tags && { tags: schema.Tags }));
|
|
51
|
+
} }) }), (schema.Security && { security: schema.Security })), (schema.Tags && { tags: schema.Tags })), (schema.Description && { description: schema.Description })), (schema.Summary && { summary: schema.Summary })), (schema.Notes && { notes: schema.Notes }));
|
|
52
52
|
return {
|
|
53
53
|
schema: finalResult,
|
|
54
54
|
handler,
|