bxo 0.0.5-dev.3 → 0.0.5-dev.4
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/index.ts +15 -8
- package/package.json +1 -1
package/index.ts
CHANGED
@@ -3,6 +3,18 @@ import { z } from 'zod';
|
|
3
3
|
// Type utilities for extracting types from Zod schemas
|
4
4
|
type InferZodType<T> = T extends z.ZodType<infer U> ? U : never;
|
5
5
|
|
6
|
+
// OpenAPI detail information
|
7
|
+
interface RouteDetail {
|
8
|
+
summary?: string;
|
9
|
+
description?: string;
|
10
|
+
tags?: string[];
|
11
|
+
operationId?: string;
|
12
|
+
deprecated?: boolean;
|
13
|
+
produces?: string[];
|
14
|
+
consumes?: string[];
|
15
|
+
[key: string]: any; // Allow additional OpenAPI properties
|
16
|
+
}
|
17
|
+
|
6
18
|
// Configuration interface for route handlers
|
7
19
|
interface RouteConfig {
|
8
20
|
params?: z.ZodSchema<any>;
|
@@ -10,6 +22,7 @@ interface RouteConfig {
|
|
10
22
|
body?: z.ZodSchema<any>;
|
11
23
|
headers?: z.ZodSchema<any>;
|
12
24
|
response?: z.ZodSchema<any>;
|
25
|
+
detail?: RouteDetail;
|
13
26
|
}
|
14
27
|
|
15
28
|
// Context type that's fully typed based on the route configuration
|
@@ -648,13 +661,7 @@ export default class BXO {
|
|
648
661
|
method: route.method,
|
649
662
|
path: route.path,
|
650
663
|
hasConfig: !!route.config,
|
651
|
-
config: route.config
|
652
|
-
hasParams: !!route.config.params,
|
653
|
-
hasQuery: !!route.config.query,
|
654
|
-
hasBody: !!route.config.body,
|
655
|
-
hasHeaders: !!route.config.headers,
|
656
|
-
hasResponse: !!route.config.response
|
657
|
-
} : null
|
664
|
+
config: route.config || null
|
658
665
|
}));
|
659
666
|
}
|
660
667
|
}
|
@@ -667,4 +674,4 @@ const error = (error: Error, status: number = 500) => {
|
|
667
674
|
export { z, error };
|
668
675
|
|
669
676
|
// Export types for external use
|
670
|
-
export type { RouteConfig, Handler };
|
677
|
+
export type { RouteConfig, RouteDetail, Handler };
|